Class ChunkModel
java.lang.Object
ghidra.framework.main.logviewer.model.ChunkModel
Stores all chunks read-in by the
ChunkReader
. The model is responsible for handling all
interaction with the list of chunks.-
Field Summary
Modifier and TypeFieldDescriptionfinal int
final int
long
long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a chunk at the given index to the model.void
Adds the given chunk to the model.void
clear()
Clears all chunks from the model.get
(int index) Returns the chunk at the given index.getFilePositionForRow
(int row) Returns the start/end byte positions within the input file for the given row.int
int
getRowForBytePos
(long selectedByte) Searches the visible chunks to see if any of them contain the given byte.int
getSize()
Returns the number of chunks in the model.iterator()
remove
(int index) Removes the chunk at the given index from the model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
selectedByteStart
public long selectedByteStart -
selectedByteEnd
public long selectedByteEnd -
NUM_LINES
public final int NUM_LINES- See Also:
-
MAX_VISIBLE_CHUNKS
public final int MAX_VISIBLE_CHUNKS- See Also:
-
-
Constructor Details
-
ChunkModel
public ChunkModel()
-
-
Method Details
-
add
Adds the given chunk to the model.- Parameters:
chunk
-
-
add
Adds a chunk at the given index to the model.- Parameters:
index
-chunk
-
-
remove
Removes the chunk at the given index from the model.- Parameters:
index
-
-
clear
public void clear()Clears all chunks from the model. -
getSize
public int getSize()Returns the number of chunks in the model.- Returns:
-
get
Returns the chunk at the given index.- Parameters:
index
-- Returns:
-
iterator
-
getNumChunks
public int getNumChunks()- Returns:
-
getFilePositionForRow
Returns the start/end byte positions within the input file for the given row. To do this we have to loop over all chunks in theChunkModel
and count the number of lines in each chunk until we get to the line (row) we're looking for. We then grab the correct value from the byteMap for that chunk line, which is the starting byte for it.- Parameters:
row
-- Returns:
- the byte position in the file this row corresponds to
-
getRowForBytePos
public int getRowForBytePos(long selectedByte) Searches the visible chunks to see if any of them contain the given byte. If so, returns the row in the table where it resides. Returns -1 otherwise.- Parameters:
selectedByte
-- Returns:
-