public class FileDatasetImpl extends java.lang.Object implements FileDataset
FileAccess dataset interface.Dataset.DatasetType| Constructor and Description |
|---|
FileDatasetImpl(FormatReader mFormat) |
FileDatasetImpl(java.lang.String datasetIdentifier,
java.lang.String datasetDescription) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(java.lang.String fileName,
java.lang.String mode)
Adds a file with the specified permission "r", "w" or "rw" to this
dataset.
|
boolean |
close()
Close access to this dataset.
|
DataAvailabilityNotifier |
getDataAvailabilityNotifier()
Retrieve the data availability notifier for this dataset.
|
Dataset.DatasetType |
getDatasetType()
Retrieve the type of the data set
|
java.lang.String |
getDescription()
Retrieve a description of the dataset
|
java.util.Collection<java.lang.String> |
getFiles()
Retrieves the list of files in this dataset.
|
java.lang.String |
getIdentifier()
Retrieve the identifier for this dataset.
|
long |
getLastModificationTime()
Retrieve the last update to this dataset
|
long |
getPosition(java.lang.String fileName)
Retrieves the position of filePointer for the given dataset
|
long |
getSize(java.lang.String fileName)
Returns the current size of the file in question
|
boolean |
hasFile(java.lang.String fileName)
Checks to see if the file is part of a given dataset
|
boolean |
initializeDataset()
Invokes the initialization of the dataset.
|
boolean |
isAvailable()
A check to see if the dataset is available
|
boolean |
isDataAvailable()
This polls the dataset to see if data is available for consumption.
|
boolean |
isInitialized()
Check to see if the dataset has been initialized
|
void |
marshall(FormatWriter mFormat) |
int |
read(java.lang.String filename,
byte[] bytesToRead)
Attempts to read a set of bytes from the underlying file.
|
int |
read(java.lang.String fileName,
java.nio.ByteBuffer readBuffer)
Attempts to read a set of bytes from the underlying file.
|
void |
removeFile(java.lang.String fileName)
Removes a file from this dataset.
|
void |
setPosition(java.lang.String fileName,
long newPosition)
Sets the position of filePointer for one of the file in the given
dataset.
|
boolean |
supportsDataAvailabilityNotifications()
Indicates whether this dataset supports dynamic data availability
notifications
|
int |
write(java.lang.String fileName,
byte[] bytesToWrite)
Writes a byte[] to a give file.
|
int |
write(java.lang.String fileName,
java.nio.ByteBuffer writeBuffer)
Write the specified Buffer to the file corresponding to the specified
file.
|
public FileDatasetImpl(java.lang.String datasetIdentifier,
java.lang.String datasetDescription)
public FileDatasetImpl(FormatReader mFormat) throws java.io.IOException, DatasetException
java.io.IOExceptionDatasetExceptionpublic void marshall(FormatWriter mFormat)
marshall in interface FormatMarshallermFormat - - The format writer to write topublic Dataset.DatasetType getDatasetType()
DatasetgetDatasetType in interface Datasetpublic java.lang.String getDescription()
DatasetgetDescription in interface Datasetpublic java.lang.String getIdentifier()
DatasetgetIdentifier in interface Datasetpublic boolean isInitialized()
DatasetisInitialized in interface Datasettrue if the dataset is initialized;
false otherwise.public boolean initializeDataset()
throws DatasetException
DatasetinitializeDataset in interface Datasettrue if the dataset has been initialized;
false otherwise.DatasetExceptionpublic boolean isAvailable()
DatasetisAvailable in interface Datasettrue if the dataset is available;
false otherwise.public boolean isDataAvailable()
DatasetisDataAvailable in interface Datasettrue if data is available on this dataset;
false otherwise.public long getLastModificationTime()
DatasetgetLastModificationTime in interface Datasetpublic boolean supportsDataAvailabilityNotifications()
DatasetsupportsDataAvailabilityNotifications in interface Datasettrue if this dataset supports data availability
notifications;false otherwise.public DataAvailabilityNotifier getDataAvailabilityNotifier()
DatasetgetDataAvailabilityNotifier in interface Datasetpublic long getSize(java.lang.String fileName)
throws DatasetException
FileDatasetgetSize in interface FileDatasetfileName - The name of the fileDatasetException - If there are problems retrieving the FileChannel corresponding
to the filepublic long getPosition(java.lang.String fileName)
throws DatasetException
FileDatasetgetPosition in interface FileDatasetfileName - The name of the file.DatasetException - If there are problems retrieving the FileChannel corresponding
to the filepublic void setPosition(java.lang.String fileName,
long newPosition)
throws DatasetException
FileDatasetsetPosition in interface FileDatasetfileName - The filenewPosition - The new position for the pointerDatasetException - If there are problems retrieving the FileChannel corresponding
to the filepublic int read(java.lang.String filename,
byte[] bytesToRead)
throws DatasetException
FileDatasetread in interface FileDatasetfilename - The file to be readbytesToRead - The byte[] to be read intoDatasetException - If there are problems retrieving the FileChannel
corresponding to the filepublic int read(java.lang.String fileName,
java.nio.ByteBuffer readBuffer)
throws DatasetException
FileDatasetread in interface FileDatasetfileName - The file to be readreadBuffer - The buffer to be read intoDatasetException - If there are problems retrieving the FileChannel
corresponding to the filepublic int write(java.lang.String fileName,
byte[] bytesToWrite)
throws DatasetException
FileDatasetwrite in interface FileDatasetfileName - The file to be written tobytesToWrite - The byte[] to be written.DatasetException - If there are problems retrieving the FileChannel
corresponding to the filepublic int write(java.lang.String fileName,
java.nio.ByteBuffer writeBuffer)
throws DatasetException
FileDatasetwrite in interface FileDatasetfileName - The file to be written towriteBuffer - The buffer holding the bytes to be writtenDatasetException - If there are problems retrieving the FileChannel
corresponding to the filepublic void addFile(java.lang.String fileName,
java.lang.String mode)
throws DatasetException
FileDatasetaddFile in interface FileDatasetfileName - The name of the filemode - The permissions associated with this fileDatasetException - If there are problems adding this filepublic void removeFile(java.lang.String fileName)
throws DatasetException
FileDatasetremoveFile in interface FileDatasetfileName - The name of the fileDatasetException - If there are problems removing this filepublic boolean hasFile(java.lang.String fileName)
FileDatasethasFile in interface FileDatasetfileName - The name of the filetrue if the file is a part of the dataset;
false otherwise.public java.util.Collection<java.lang.String> getFiles()
FileDatasetgetFiles in interface FileDatasetpublic boolean close()
throws DatasetException
Datasetclose in interface Datasettrue if a graceful closure of this dataset was
performed;false otherwise.DatasetException