![]() / Size of buffer (in bytes) to read each time we read from the ![]() / Encoding to use when converting bytes to text / Means of creating a Stream to read from. Private const int DefaultBufferSize = 4096 / a different buffer size - this is useful for testing. Public sealed class ReverseLineReader : IEnumerable / returned by the function must be seekable. / Only single byte encodings, and UTF-8 and Unicode, are supported. / (or a filename for convenience) and yields lines from the end of the stream backwards. / Takes an encoding (defaulting to UTF-8) and a function which produces a seekable stream Ah, y necesita refactorización, hay un método bastante fuerte, como verán: Utiliza StreamUtil de MiscUtil, pero he incluido el método necesario (nuevo) desde allí en la parte inferior. No hay nada incorporado en el marco, y sospecho que tendrías que hacer una codificación dura separada para cada codificación de ancho variable.ĮDITAR: Esto ha sido algo probado, pero eso no quiere decir que todavía no tenga algunos errores sutiles. Cuando tenga codificación de tamaño variable (como UTF-8), tendrá que comprobar si está en medio de un personaje o no cuando obtiene datos. ![]() ![]() Leer archivos de texto al revés es realmente complicado a menos que esté utilizando una codificación de tamaño fijo (por ejemplo, ASCII). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |