public class HdfFileChannel extends java.lang.Object implements HdfBackingStorage
FileChannel
and combines it with the HDF5
Superblock
. It allows a single object to be passed around inside a
HdfFile
and provides convenience methods for common operations.Constructor and Description |
---|
HdfFileChannel(java.nio.channels.FileChannel fileChannel,
Superblock superblock) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.nio.channels.FileChannel |
getFileChannel() |
int |
getSizeOfLengths() |
int |
getSizeOfOffsets() |
Superblock |
getSuperblock() |
long |
getUserBlockSize() |
boolean |
inMemory() |
java.nio.ByteBuffer |
map(long address,
long length) |
java.nio.ByteBuffer |
mapNoOffset(long address,
long length) |
java.nio.ByteBuffer |
readBufferFromAddress(long address,
int length)
Reads from the HDF file into a
ByteBuffer . |
long |
size() |
public HdfFileChannel(java.nio.channels.FileChannel fileChannel, Superblock superblock)
public java.nio.ByteBuffer readBufferFromAddress(long address, int length)
ByteBuffer
. It takes in to account the
'base address' so the offset for user block is handled. It also converts the
buffer to ByteOrder.LITTLE_ENDIAN
and rewinds the buffer ready for
use.readBufferFromAddress
in interface HdfBackingStorage
address
- the address to read fromlength
- the length of the buffer to readHdfException
- if an error occurs during the readpublic java.nio.ByteBuffer map(long address, long length)
map
in interface HdfBackingStorage
public java.nio.ByteBuffer mapNoOffset(long address, long length)
mapNoOffset
in interface HdfBackingStorage
public long getUserBlockSize()
getUserBlockSize
in interface HdfBackingStorage
public Superblock getSuperblock()
getSuperblock
in interface HdfBackingStorage
public java.nio.channels.FileChannel getFileChannel()
getFileChannel
in interface HdfBackingStorage
public int getSizeOfOffsets()
getSizeOfOffsets
in interface HdfBackingStorage
public int getSizeOfLengths()
getSizeOfLengths
in interface HdfBackingStorage
public final void close()
close
in interface HdfBackingStorage
public long size()
size
in interface HdfBackingStorage
public boolean inMemory()
inMemory
in interface HdfBackingStorage