java.io.Closeable, java.io.DataInput, java.io.ObjectInput, java.lang.AutoCloseable, ErrorInfo, ErrorObjectInput, Limit, LimitObjectInputpublic final class ArrayInputStream extends java.io.InputStream implements LimitObjectInput
| Modifier and Type | Field | Description |
|---|---|---|
private int |
end |
|
private ErrorObjectInput |
oi |
|
private byte[] |
pageData |
|
private int |
position |
|
private int |
start |
| Constructor | Description |
|---|---|
ArrayInputStream() |
Create an ArrayInputStream with a zero length byte array.
|
ArrayInputStream(byte[] data) |
Create an ArrayInputStream with the passed in data.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
|
int |
clearLimit() |
Clears the limit by setting the limit to be the entire byte array.
|
byte[] |
getData() |
Return a reference to the array of bytes this stream is going to read
from so that caller may load it with stuff
|
java.lang.String |
getErrorInfo() |
|
java.lang.Exception |
getNestedException() |
|
int |
getPosition() |
|
int |
read() |
|
int |
read(byte[] b,
int off,
int len) |
|
boolean |
readBoolean() |
|
byte |
readByte() |
|
char |
readChar() |
|
int |
readCompressedInt() |
Read a compressed int from the stream.
|
long |
readCompressedLong() |
Read a compressed long from the stream.
|
int |
readDerbyUTF(char[][] rawData_array,
int utflen) |
read in a Derby UTF formated string into a char[].
|
double |
readDouble() |
|
float |
readFloat() |
|
void |
readFully(byte[] b) |
|
void |
readFully(byte[] b,
int off,
int len) |
|
int |
readInt() |
|
java.lang.String |
readLine() |
|
long |
readLong() |
|
java.lang.Object |
readObject() |
|
short |
readShort() |
|
int |
readUnsignedByte() |
|
int |
readUnsignedShort() |
|
java.lang.String |
readUTF() |
|
void |
setData(byte[] data) |
Set the array of bytes to be read.
|
void |
setLimit(int length) |
Set the limit of the data that can be read or written.
|
void |
setLimit(int offset,
int length) |
A setLimit which also sets the position to be offset.
|
void |
setPosition(int newPosition) |
|
long |
skip(long count) |
Skip as many bytes as possible, but no more than
count. |
int |
skipBytes(int n) |
Skip as many bytes as possible, but no more than
n. |
close, mark, markSupported, read, readAllBytes, readNBytes, reset, transferToprivate byte[] pageData
private int start
private int end
private int position
private ErrorObjectInput oi
public ArrayInputStream()
public ArrayInputStream(byte[] data)
data - public void setData(byte[] data)
public byte[] getData()
public int read()
throws java.io.IOException
read in interface java.io.ObjectInputread in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface java.io.ObjectInputread in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long count)
throws java.io.IOException
count.skip in interface java.io.ObjectInputskip in class java.io.InputStreamcount - the number of bytes to skipjava.io.IOExceptionpublic int getPosition()
public final void setPosition(int newPosition)
throws java.io.IOException
java.io.IOExceptionpublic int available()
throws java.io.IOException
available in interface java.io.ObjectInputavailable in class java.io.InputStreamjava.io.IOExceptionpublic void setLimit(int offset,
int length)
throws java.io.IOException
java.io.IOException - limit is out of rangepublic final void setLimit(int length)
throws java.io.IOException
LimitOn input classes (e.g. InputStreams) any attempt to read or skip beyond the limit will result in an end of file indication (e.g. read() methods returning -1 or throwing EOFException).
On output classes (e.g. OutputStream) any attempt to write more beyond the limit will result in an EOFException
public final int clearLimit()
clearLimit in interface LimitLimit.clearLimit()public final void readFully(byte[] b)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOExceptionpublic final void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOExceptionpublic final int skipBytes(int n)
throws java.io.IOException
n.skipBytes in interface java.io.DataInputn - the number of bytes to skipjava.io.IOExceptionpublic final boolean readBoolean()
throws java.io.IOException
readBoolean in interface java.io.DataInputjava.io.IOExceptionpublic final byte readByte()
throws java.io.IOException
readByte in interface java.io.DataInputjava.io.IOExceptionpublic final int readUnsignedByte()
throws java.io.IOException
readUnsignedByte in interface java.io.DataInputjava.io.IOExceptionpublic final short readShort()
throws java.io.IOException
readShort in interface java.io.DataInputjava.io.IOExceptionpublic final int readUnsignedShort()
throws java.io.IOException
readUnsignedShort in interface java.io.DataInputjava.io.IOExceptionpublic final char readChar()
throws java.io.IOException
readChar in interface java.io.DataInputjava.io.IOExceptionpublic final int readInt()
throws java.io.IOException
readInt in interface java.io.DataInputjava.io.IOExceptionpublic final long readLong()
throws java.io.IOException
readLong in interface java.io.DataInputjava.io.IOExceptionpublic final float readFloat()
throws java.io.IOException
readFloat in interface java.io.DataInputjava.io.IOExceptionpublic final double readDouble()
throws java.io.IOException
readDouble in interface java.io.DataInputjava.io.IOExceptionpublic final java.lang.String readLine()
throws java.io.IOException
readLine in interface java.io.DataInputjava.io.IOExceptionpublic final java.lang.String readUTF()
throws java.io.IOException
readUTF in interface java.io.DataInputjava.io.IOExceptionpublic final int readDerbyUTF(char[][] rawData_array,
int utflen)
throws java.io.IOException
This routine inline's the code to read a UTF format string from a byte[] array (pageData), into a char[] array. The string will be read into the char[] array passed into this routine through rawData_array[0] if it is big enough. If it is not big enough a new char[] will be alocated and returned to the caller by putting it into rawData_array[0].
To see detailed description of the Derby UTF format see the writeExternal() routine of SQLChar.
The routine returns the number of char's read into the returned char[], note that this length may smaller than the actual length of the char[] array.
The stream must be positioned on the first user byte when this method is invoked.
rawData_array - This parameter uses a element array to implement
an in/out function parameter. The char[] array
in rawData_array[0] is used to read the data into
unless it is not big enough, then a new array
is allocated and the old one discarded. In
either case on return rawData_array[0] contains
the filled in char[] - caller must allow that
the array may or may not be different from the
one passed in.utflen - the byte length of the value, or 0 if unknownjava.io.IOException - if an I/O error happenspublic final int readCompressedInt()
throws java.io.IOException
Read a compressed int from the stream, which is assumed to have been written by a call to CompressNumber.writeInt().
Code from CompressedNumber is inlined here so that these fields can be read from the array with a minimum of function calls.
The format of a compressed int is as follows: Formats are (with x representing value bits):
1 Byte- 00xxxxxx val <= 63 (0x3f) 2 Byte- 01xxxxxx xxxxxxxx val > 63 && <= 16383 (0x3fff) 4 byte- 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx val > 16383 && <= MAX_INT
java.io.IOException - if an I/O error happenspublic final long readCompressedLong()
throws java.io.IOException
Read a compressed long from the stream, which is assumed to have been written by a call to CompressNumber.writeLong().
Code from CompressedNumber is inlined here so that these fields can be read from the array with a minimum of function calls.
The format of a compressed int is as follows: Formats are (with x representing value bits):
value ≷= 16383 (0x3fff):
2 byte - 00xxxxxx xxxxxxxx
value > 16383 && <= 0x3fffffff:
4 byte - 01xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
value < 0x3fffffff &< <= MAX_LONG:
8 byte - 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
java.io.IOExceptionpublic java.lang.Object readObject()
throws java.lang.ClassNotFoundException,
java.io.IOException
readObject in interface java.io.ObjectInputjava.lang.ClassNotFoundExceptionjava.io.IOExceptionpublic java.lang.String getErrorInfo()
getErrorInfo in interface ErrorInfogetErrorInfo in interface ErrorObjectInputpublic java.lang.Exception getNestedException()
getNestedException in interface ErrorInfogetNestedException in interface ErrorObjectInputApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.