Class ReverseLineReader
java.lang.Object
ghidra.framework.main.logviewer.model.ReverseLineReader
Reads in a single line of text from a given input file, in reverse order.
CONOPS:
1. Start at a given position in the file and read BUFFER_SIZE bytes into a byte array
2. From the end of the array, read a character
3. If the character represents a newline (or carriage return), the line is finished, so return.
4. If not, continue reading.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionreadLine()
Reads a single line from the current file pointer position, in reverse.void
setFilePos
(long position) Moves the file pointer to the given byte location.
-
Field Details
-
raf
-
-
Constructor Details
-
ReverseLineReader
- Parameters:
encoding
-raf
-- Throws:
IOException
-
-
Method Details
-
setFilePos
public void setFilePos(long position) Moves the file pointer to the given byte location.- Parameters:
position
-
-
readLine
Reads a single line from the current file pointer position, in reverse. To do this we do the following: 1. Read a 'large enough' number of bytes into a buffer (enough to guarantee a full line of text. 2. Move backwards through the bytes just read until a newline or carriage return is found. 3. Throw away the rest of the bytes and return the line found.- Returns:
- Throws:
IOException
-