public class FileChannelRandomAccessSource extends java.lang.Object implements RandomAccessSource
FileChannel. The entire channel will be mapped into memory for efficient reads.| Constructor and Description |
|---|
FileChannelRandomAccessSource(java.nio.channels.FileChannel channel)
Constructs a new
FileChannelRandomAccessSource based on the specified FileChannel. |
public FileChannelRandomAccessSource(java.nio.channels.FileChannel channel)
throws java.io.IOException
FileChannelRandomAccessSource based on the specified FileChannel. The entire source channel will be mapped into memory.channel - the channel to use as the backing storejava.io.IOException - if the channel cannot be opened or mappedpublic void close()
throws java.io.IOException
close in interface RandomAccessSourcejava.io.IOExceptionpublic int get(long position)
throws java.io.IOException
get in interface RandomAccessSourcejava.io.IOExceptionpublic int get(long position,
byte[] bytes,
int off,
int len)
throws java.io.IOException
get in interface RandomAccessSourceposition - the position in the RandomAccessSource to read frombytes - output bufferoff - offset into the output buffer where results will be placedlen - the number of bytes to readjava.io.IOExceptionpublic long length()
length in interface RandomAccessSourceCopyright © 2013. All Rights Reserved.