fiftyone.mobile.detection.entities.stream
Class Source
java.lang.Object
fiftyone.mobile.detection.entities.stream.Source
- All Implemented Interfaces:
- Disposable
public class Source
- extends Object
- implements Disposable
Encapsulates either a byte array or a file containing the uncompressed data
structures used by the data set.
Must be disposed to ensure that the
readers are closed and the file free for other uses. Does not need to be
disposed if a byte array is used.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileInputStream
private final FileInputStream fileInputStream
data
private final byte[] data
Source
public Source(String filename)
throws FileNotFoundException
- Throws:
FileNotFoundException
Source
public Source(byte[] data)
dispose
public void dispose()
- Specified by:
dispose in interface Disposable
createReader
public BinaryReader createReader()
throws IOException
- Creates a new reader and stores a reference to it.
- Returns:
- A reader open for read access to the stream
- Throws:
IOException
createByteBuffer
private ByteBuffer createByteBuffer()
throws IOException
- Throws:
IOException
createMappedByteBuffer
private MappedByteBuffer createMappedByteBuffer()
throws IOException
- Throws:
IOException