MeasurableStream, RepositionableStream, java.io.Closeable, java.lang.AutoCloseablepublic class FastMultiByteArrayInputStream extends MeasurableInputStream implements RepositionableStream
FastByteArrayInputStream,
but it can hold 256 PiB of data. The relevant constructor is FastMultiByteArrayInputStream(InputStream, long),
which fetches a stream and loads it into a sequence of byte arrays.| Modifier and Type | Field | Description |
|---|---|---|
byte[][] |
array |
The array of arrays backing the input stream, plus an additional
null entry. |
byte[] |
current |
The current array.
|
long |
length |
The number of valid bytes in
array. |
static int |
SLICE_BITS |
The number of bits of an array slice index.
|
static int |
SLICE_MASK |
The mask to retrieve a slice offset.
|
static int |
SLICE_SIZE |
The maximum length of an array slice.
|
| Constructor | Description |
|---|---|
FastMultiByteArrayInputStream(byte[] array) |
Creates a new multi-array input stream using a given array.
|
FastMultiByteArrayInputStream(FastMultiByteArrayInputStream is) |
Creates a new multi-array input stream sharing the backing arrays of another multi-array input stream.
|
FastMultiByteArrayInputStream(MeasurableInputStream is) |
Creates a new multi-array input stream loading it from a measurable input stream.
|
FastMultiByteArrayInputStream(java.io.InputStream is,
long size) |
Creates a new multi-array input stream loading it from an input stream.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking.
|
void |
close() |
NOP.
|
long |
length() |
Returns the overall length of this stream (optional operation).
|
void |
mark(int dummy) |
|
boolean |
markSupported() |
|
long |
position() |
Returns the current stream position.
|
void |
position(long newPosition) |
Sets the current stream position.
|
int |
read() |
|
int |
read(byte[] b,
int offset,
int length) |
|
void |
reset() |
|
long |
skip(long n) |
public static final int SLICE_BITS
public static final int SLICE_SIZE
public static final int SLICE_MASK
public byte[][] array
null entry.public byte[] current
public long length
array.public FastMultiByteArrayInputStream(MeasurableInputStream is) throws java.io.IOException
is - the input stream that will fill the array.java.io.IOExceptionpublic FastMultiByteArrayInputStream(java.io.InputStream is,
long size)
throws java.io.IOException
is - the input stream that will fill the array.size - the number of bytes to be read from is.java.io.IOExceptionpublic FastMultiByteArrayInputStream(FastMultiByteArrayInputStream is)
is - the multi-array input stream to replicate.public FastMultiByteArrayInputStream(byte[] array)
array - the backing array.public int available()
Note that this number may be smaller than the number of bytes actually
available from the stream if this number exceeds Integer.MAX_VALUE.
available in class java.io.InputStreamInteger.MAX_VALUE.public long skip(long n)
skip in class java.io.InputStreampublic int read()
read in class java.io.InputStreampublic int read(byte[] b,
int offset,
int length)
read in class java.io.InputStreampublic long position()
RepositionableStreamposition in interface MeasurableStreamposition in interface RepositionableStreampublic void position(long newPosition)
RepositionableStreamposition in interface RepositionableStreamnewPosition - the new stream position.public long length()
throws java.io.IOException
MeasurableStreamlength in interface MeasurableStreamjava.io.IOExceptionpublic void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class java.io.InputStreampublic boolean markSupported()
markSupported in class java.io.InputStreampublic void mark(int dummy)
mark in class java.io.InputStreampublic void reset()
reset in class java.io.InputStream