Package com.mckoi.database
Class FixedSizeDataStore.SectorInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.mckoi.database.FixedSizeDataStore.SectorInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- FixedSizeDataStore
private final class FixedSizeDataStore.SectorInputStream extends java.io.InputStream
An input stream that reads information across a sector chain starting at the given head sector.
-
-
Field Summary
Fields Modifier and Type Field Description private int
count
The number of bytes we have read.private int
index
Current index in buf.private int
sector
The current sector we are traversing.private byte[]
sector_buffer
A reference to the sector buffer.
-
Constructor Summary
Constructors Constructor Description SectorInputStream(int sector_head)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
loadNextSector()
Loads the next sector in the chain into sector_buffer and sets index to the start of the buffer.int
read()
int
read(byte[] b, int offset, int len)
long
skip(long len)
-
-
-
Method Detail
-
loadNextSector
private void loadNextSector() throws java.io.IOException
Loads the next sector in the chain into sector_buffer and sets index to the start of the buffer.- Throws:
java.io.IOException
-
read
public final int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int offset, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
skip
public long skip(long len) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-