public abstract class BinaryDataSource
extends java.lang.Object
PamDataBlock
Constructor and Description |
---|
BinaryDataSource(PamDataBlock sisterDataBlock)
Create a binary data source.
|
BinaryDataSource(PamDataBlock sisterDataBlock,
boolean doBinaryStore)
Create a binary data source.
|
Modifier and Type | Method and Description |
---|---|
BinaryOutputStream |
getBinaryStorageStream() |
byte[] |
getModuleFooterData() |
abstract byte[] |
getModuleHeaderData() |
java.lang.String |
getModuleName() |
java.lang.String |
getModuleType() |
abstract int |
getModuleVersion()
Get a version number for the module.
|
abstract PackedBinaryObject |
getPackedData(PamDataUnit pamDataUnit)
Get packed binary data for either sending to file or over the network
|
PamDataBlock |
getSisterDataBlock() |
DataMapDrawing |
getSpecialDrawing()
REturn a class capable of overriding the normal drawing on
the data map
|
abstract java.lang.String |
getStreamName() |
abstract int |
getStreamVersion() |
boolean |
isDoBinaryStore() |
boolean |
isStoreData()
Flag to say we want to actually store the data.
|
abstract void |
newFileOpened(java.io.File outputFile)
Called from the BinaryOutputStream whenever a new output
file is opened.
|
void |
reset()
Reset anything needing resetting in the binary data source.
|
boolean |
saveData(PamDataUnit pamDataUnit)
Save data into the binary stream
|
void |
setBinaryStorageStream(BinaryOutputStream binaryStorageStream) |
void |
setDoBinaryStore(boolean doBinaryStore) |
void |
setStoreData(boolean storeData)
Flag to say we want to actually store the data.
|
abstract PamDataUnit |
sinkData(BinaryObjectData binaryObjectData,
BinaryHeader bh,
int moduleVersion)
Convert data read back in in viewer mode into the correct
type of PamDataUnit.
|
abstract ModuleFooter |
sinkModuleFooter(BinaryObjectData binaryObjectData,
BinaryHeader bh,
ModuleHeader moduleHeader)
Do something with module footer information
|
abstract ModuleHeader |
sinkModuleHeader(BinaryObjectData binaryObjectData,
BinaryHeader bh)
Do something with module header information
|
boolean |
storeData(int objectId,
long timeMillis,
byte[] data) |
public BinaryDataSource(PamDataBlock sisterDataBlock)
sisterDataBlock
- dataBlock for data to store / sendpublic BinaryDataSource(PamDataBlock sisterDataBlock, boolean doBinaryStore)
sisterDataBlock
- dataBlock for data to store / senddoBinaryStore
- true if data to be stored by default, false otherwise.public java.lang.String getModuleType()
public java.lang.String getModuleName()
public abstract java.lang.String getStreamName()
public abstract int getStreamVersion()
public abstract int getModuleVersion()
This is different to the version number in the main file header and allows individual modules to update their format and maintain backwards compatibility with old data
public abstract byte[] getModuleHeaderData()
public byte[] getModuleFooterData()
public abstract PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion)
DO NOT add this unit directly to the datablock, but pass it back to the calling process which will add it to the datablock if necessary.
binaryObjectData
- Binary data read back from a file.bh
- binary header from start of file.moduleVersion
- public abstract ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh)
binaryObjectData
- data for the module header.bh
- Binary header informationpublic abstract ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader moduleHeader)
binaryObjectData
- data for the module header.bh
- Binary header informationpublic void setBinaryStorageStream(BinaryOutputStream binaryStorageStream)
binaryStorageStream
- the binaryStorageStream to setpublic BinaryOutputStream getBinaryStorageStream()
public final boolean saveData(PamDataUnit pamDataUnit)
pamDataUnit
- public abstract PackedBinaryObject getPackedData(PamDataUnit pamDataUnit)
pamDataUnit
- data unit to packpublic boolean storeData(int objectId, long timeMillis, byte[] data)
objectId
- timeMillis
- data
- public PamDataBlock getSisterDataBlock()
public abstract void newFileOpened(java.io.File outputFile)
outputFile
- file information.public DataMapDrawing getSpecialDrawing()
public void setDoBinaryStore(boolean doBinaryStore)
doBinaryStore
- the doBinaryStore to set
This flag tells the binary store that this unit is available for binary storage. It's
used mostly in raw data blocks which use this same class to write to a network socket
but have the ability to wrote to the binary store disabled.public boolean isDoBinaryStore()
public void reset()
public boolean isStoreData()
public void setStoreData(boolean storeData)
storeData
- the storeData to set