public class BundleReader extends java.lang.Object implements BundleStreamSource
BundleStreamSource.Event
Modifier and Type | Field and Description |
---|---|
(package private) java.nio.MappedByteBuffer |
buffer
The stream buffer.
|
(package private) java.lang.Object[] |
data
Current object.
|
(package private) boolean |
hasids
Whether or not we have DBIDs.
|
(package private) java.nio.channels.FileChannel |
input
Input channel.
|
static int |
MAGIC
Magic number, shared with
BundleReader . |
(package private) BundleMeta |
meta
Bundle metadata.
|
(package private) ByteBufferSerializer<?>[] |
sers
Serializers to use.
|
Constructor and Description |
---|
BundleReader(java.nio.channels.FileChannel input)
Constructor.
|
BundleReader(java.nio.MappedByteBuffer buffer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MultipleObjectsBundle |
asMultipleObjectsBundle()
Return (or collect) the stream as bundle.
|
boolean |
assignDBID(DBIDVar var)
Assign the current object ID to a
DBIDVar . |
java.lang.Object |
data(int rnum)
Access a particular object and representation.
|
BundleMeta |
getMeta()
Get the current meta data.
|
boolean |
hasDBIDs()
Indicate whether the stream contains DBIDs.
|
BundleStreamSource.Event |
nextEvent()
Get the next event
|
(package private) void |
openBuffer()
Map the input file.
|
(package private) void |
readMeta()
Read the metadata.
|
(package private) void |
readObject()
Read an object.
|
public static final int MAGIC
BundleReader
.java.nio.MappedByteBuffer buffer
BundleMeta meta
java.nio.channels.FileChannel input
ByteBufferSerializer<?>[] sers
java.lang.Object[] data
boolean hasids
public BundleReader(java.nio.MappedByteBuffer buffer)
buffer
- Input bufferpublic BundleReader(java.nio.channels.FileChannel input)
input
- Input channelpublic BundleMeta getMeta()
BundleStreamSource
getMeta
in interface BundleStreamSource
void openBuffer()
void readMeta()
void readObject()
public BundleStreamSource.Event nextEvent()
BundleStreamSource
nextEvent
in interface BundleStreamSource
public java.lang.Object data(int rnum)
BundleStreamSource
data
in interface BundleStreamSource
rnum
- Representation numberpublic boolean hasDBIDs()
BundleStreamSource
hasDBIDs
in interface BundleStreamSource
true
if the stream contains DBIDs.public boolean assignDBID(DBIDVar var)
BundleStreamSource
DBIDVar
.assignDBID
in interface BundleStreamSource
var
- Variable to assign the object id tofalse
when no object id is availablepublic MultipleObjectsBundle asMultipleObjectsBundle()
BundleStreamSource
asMultipleObjectsBundle
in interface BundleStreamSource
Copyright © 2019 ELKI Development Team. License information.