Class LineStream

Support reading of file (or string in memory) by lines

Support utf8, utf16, utf32 be and le encodings, and line endings - according to D language source file specification.

Low resource consuming. Doesn't flood with GC allocations. Dup line if you want to store it somewhere.

Tracks line number.

Inherits from

  • Object (base class)

Constructors

Name Description
this this constructor was created for unittests only
this Open file with known encoding

Fields

Name Type Description
LINE_POSITION_UNDEFINED immutable(uint) Unknown line position
BYTE_BUFFER_SIZE immutable(int)
invalidCharFlag bool
QUARTER_BYTE_BUFFER_SIZE immutable(int)
TEXT_BUFFER_SIZE immutable(int)
_bomDetected bool
_crCount int
_crlfCount int
_lfCount int

Properties

Name Type Description
encoding [get] EncodingType Returns file encoding EncodingType
errorCode [get] int Returns error code
errorLine [get] int Returns line where error is found
errorMessage [get] string Returns error message
errorPos [get] int Returns line position (number of character in line) where error is found
filename [get] string Returns file name
line [get] uint Returns current line number
textFormat [get] TextFileFormat

Methods

Name Description
create Factory for InputStream parser
create Factory method for string parser
readLine Read line from stream
appendedText
consumedBytes
decodeText
invalidCharError
readBytes returns slice of bytes available in buffer
reserveTextBuf
setError

Enums

Name Description
ErrorCodes Error codes

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0