public final class LineParser extends Object
Intended for cases where:
Offers a fast paths for:
They can be combined for maximum performance.
CR
, LF
and CR LF
to bytes using the give character setIf the file is larger can 2GB then it is mapped into memory multiple times. This has to be done because Java does not support file mappings larger than 2GB.
Unmapping the file from memory is controversial and can only be done using semi-official APIs. The alternative would be to rely on finalization to close file handles.
This class is thread safe.
Line
Constructor | Description |
---|---|
LineParser() |
Modifier and Type | Method | Description |
---|---|---|
void |
forEach(Path path,
Charset cs,
Consumer<Line> lineCallback) |
Internal iterator over every line in a file.
|
public void forEach(Path path, Charset cs, Consumer<Line> lineCallback) throws IOException
This method is thread safe.
path
- the file to parsecs
- the character set to uselineCallback
- callback executed for every lineIOException
- if an exception happens when readingUnmapFailedException
- if unampping fails, this can happen on non OpenJDK
JREs or JREs that are newer than expected or security managersCopyright © 2015–2017. All rights reserved.