Package eu.bandm.tools.util.files
Class NewlineCompleter
java.lang.Object
java.io.Reader
java.io.FilterReader
eu.bandm.tools.util.files.NewlineCompleter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
A secondary Reader that supplies one single newline at the
end of the file, if there is none.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean
Whether the last character has been read from the peer reader.(package private) boolean
Whether the last read character was a newline or a carriage return character.Fields inherited from class java.io.FilterReader
in
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
read()
Append one last final newline character, if reading has ended with a character neither newline nor carriage return.Methods inherited from class java.io.FilterReader
close, mark, markSupported, read, ready, reset, skip
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
Field Details
-
isEnded
boolean isEndedWhether the last character has been read from the peer reader. -
lastWasLf
boolean lastWasLfWhether the last read character was a newline or a carriage return character.
-
-
Constructor Details
-
NewlineCompleter
Only constructor- Parameters:
in
- the underyling reader
-
-
Method Details
-
read
Append one last final newline character, if reading has ended with a character neither newline nor carriage return.- Overrides:
read
in classFilterReader
- Returns:
- the read character
- Throws:
IOException
-