Package com.mckoi.database
Class CellBufferInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.mckoi.database.CellBufferInputStream
-
- All Implemented Interfaces:
CellInput
,java.io.Closeable
,java.io.DataInput
,java.lang.AutoCloseable
final class CellBufferInputStream extends java.io.InputStream implements CellInput
This is a reusable cell stream object that is extended from the ByteArrayInputStream class, which provides methods for reusing the object on a different byte[] arrays. It is used as an efficient way of reading cell information from a binary fixed length cell type file.It would usually be wrapped in a DataInputStream object.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
buf
private char[]
char_buffer
private int
count
private int
mark
private int
pos
-
Constructor Summary
Constructors Constructor Description CellBufferInputStream()
The Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
mark(int readAheadLimit)
int
read()
Sped up methods.int
read(byte[] b, int off, int len)
boolean
readBoolean()
byte
readByte()
char
readChar()
java.lang.String
readChars(int length)
Reads a string of chars from the input stream up to the given length and returns it as a String object.double
readDouble()
float
readFloat()
void
readFully(byte[] b)
void
readFully(byte[] b, int off, int len)
int
readInt()
java.lang.String
readLine()
long
readLong()
short
readShort()
int
readUnsignedByte()
int
readUnsignedShort()
java.lang.String
readUTF()
void
reset()
(package private) void
setArray(byte[] new_buffer)
Sets up the stream to the start of the underlying array.(package private) void
setArray(byte[] new_buffer, int offset, int length)
Sets up the stream to the underlying array with the given variables.long
skip(long n)
int
skipBytes(int n)
-
-
-
Method Detail
-
setArray
void setArray(byte[] new_buffer)
Sets up the stream to the start of the underlying array.
-
setArray
void setArray(byte[] new_buffer, int offset, int length)
Sets up the stream to the underlying array with the given variables.
-
read
public int read()
Sped up methods.- Specified by:
read
in classjava.io.InputStream
-
read
public int read(byte[] b, int off, int len)
- Overrides:
read
in classjava.io.InputStream
-
skip
public long skip(long n)
- Overrides:
skip
in classjava.io.InputStream
-
available
public int available()
- Overrides:
available
in classjava.io.InputStream
-
mark
public void mark(int readAheadLimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset()
- Overrides:
reset
in classjava.io.InputStream
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] b) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
skipBytes
public int skipBytes(int n) throws java.io.IOException
- Specified by:
skipBytes
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readBoolean
public boolean readBoolean() throws java.io.IOException
- Specified by:
readBoolean
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readByte
public byte readByte() throws java.io.IOException
- Specified by:
readByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedByte
public int readUnsignedByte() throws java.io.IOException
- Specified by:
readUnsignedByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readShort
public short readShort() throws java.io.IOException
- Specified by:
readShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedShort
public int readUnsignedShort() throws java.io.IOException
- Specified by:
readUnsignedShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readChar
public char readChar() throws java.io.IOException
- Specified by:
readChar
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readChars
public java.lang.String readChars(int length) throws java.io.IOException
Description copied from interface:CellInput
Reads a string of chars from the input stream up to the given length and returns it as a String object.
-
readInt
public int readInt() throws java.io.IOException
- Specified by:
readInt
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLong
public long readLong() throws java.io.IOException
- Specified by:
readLong
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFloat
public float readFloat() throws java.io.IOException
- Specified by:
readFloat
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readDouble
public double readDouble() throws java.io.IOException
- Specified by:
readDouble
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLine
public java.lang.String readLine() throws java.io.IOException
- Specified by:
readLine
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUTF
public java.lang.String readUTF() throws java.io.IOException
- Specified by:
readUTF
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
-