public interface DataSource extends Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Tries to free all resources.
|
ByteBuffer |
map(long startPosition,
long size)
Maps a part of this
DataSource into a ByteBuffer. |
long |
position()
Returns the DataSource's current position.
|
void |
position(long nuPos)
Sets the DataSource's position.
|
int |
read(ByteBuffer byteBuffer)
Reads a sequence of bytes from this channel into the given buffer.
|
long |
size()
Returns the current size of this DataSource.
|
long |
transferTo(long position,
long count,
WritableByteChannel target)
Transfers bytes from this DataSource to the given writable byte
channel.
|
int read(ByteBuffer byteBuffer) throws IOException
byteBuffer - sink for this read operationIOException - If some I/O error occurslong size() throws IOException
IOException - If some I/O error occurslong position()
throws IOException
IOException - If some I/O error occursvoid position(long nuPos)
throws IOException
nuPos - The new position, a non-negative integer counting
the number of bytes from the beginning of the dataIOException - If some I/O error occurslong transferTo(long position,
long count,
WritableByteChannel target)
throws IOException
position - The position within the DataSource at which the transfer is to begin;
must be non-negativecount - The maximum number of bytes to be transferred; must be
non-negativetarget - The target channelIOException - If some I/O error occursByteBuffer map(long startPosition, long size) throws IOException
DataSource into a ByteBuffer. It might utilize
an operating system supported memory mapped file or potentially just reads the requested
portion of the file into the memory.startPosition - where the requested block startsize - size of the requested blockDataSourceIOException - If some I/O error occursvoid close()
throws IOException
close in interface AutoCloseableclose in interface CloseableIOException - If some I/O error occursCopyright © 2015. All rights reserved.