public class ByteBufferInputStream
extends it.unimi.dsi.fastutil.io.MeasurableInputStream
implements it.unimi.dsi.fastutil.io.RepositionableStream
The main usefulness of this class is that of making it possible creating input streams
that are really based on a MappedByteBuffer.
In particular, the factory method map(FileChannel, FileChannel.MapMode)
will memory-map an entire file into an array of ByteBuffer and expose the array as
a ByteBufferInputStream. This makes it possible to access easily mapped files larger
than 2GiB.
| Modifier and Type | Field and Description |
|---|---|
static long |
CHUNK_SIZE
The size of a chunk created by
map(FileChannel, FileChannel.MapMode). |
| Modifier | Constructor and Description |
|---|---|
|
ByteBufferInputStream(ByteBuffer byteBuffer)
Creates a new byte-buffer input stream from a single
ByteBuffer. |
protected |
ByteBufferInputStream(ByteBuffer[] byteBuffer)
Creates a new byte-buffer input stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
ByteBufferInputStream |
copy() |
long |
length() |
static ByteBufferInputStream |
map(FileChannel fileChannel,
FileChannel.MapMode mapMode) |
void |
mark(int unused) |
boolean |
markSupported() |
long |
position() |
void |
position(long newPosition) |
int |
read() |
int |
read(byte[] b,
int offset,
int length) |
void |
reset() |
long |
skip(long n) |
close, readpublic static final long CHUNK_SIZE
map(FileChannel, FileChannel.MapMode).public ByteBufferInputStream(ByteBuffer byteBuffer)
ByteBuffer.byteBuffer - the underlying byte buffer.protected ByteBufferInputStream(ByteBuffer[] byteBuffer)
byteBuffer - the underlying byte buffers.public static ByteBufferInputStream map(FileChannel fileChannel, FileChannel.MapMode mapMode) throws IOException
IOExceptionpublic int available()
available in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic void mark(int unused)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionpublic int read()
read in class InputStreampublic int read(byte[] b,
int offset,
int length)
read in class InputStreampublic long length()
length in interface it.unimi.dsi.fastutil.io.MeasurableStreampublic long position()
position in interface it.unimi.dsi.fastutil.io.MeasurableStreamposition in interface it.unimi.dsi.fastutil.io.RepositionableStreampublic void position(long newPosition)
position in interface it.unimi.dsi.fastutil.io.RepositionableStreampublic ByteBufferInputStream copy()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.