public class FileDatasetImpl extends Object implements FileDataset
FileAccess
dataset interface.Dataset.DatasetType
Constructor and Description |
---|
FileDatasetImpl(ds.funnel.data.format.FormatReader mFormat) |
FileDatasetImpl(String datasetIdentifier,
String datasetDescription) |
Modifier and Type | Method and Description |
---|---|
void |
addFile(String fileName,
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.
|
String |
getDatasetIdentifier()
Retrieve the identifier for this dataset.
|
Dataset.DatasetType |
getDatasetType()
Retrieve the type of the data set
|
String |
getDescription()
Retrieve a description of the dataset
|
Collection<String> |
getFiles()
Retrieves the list of files in this dataset.
|
long |
getLastModificationTime()
Retrieve the last update to this dataset
|
long |
getPosition(String fileName)
Retrieves the position of filePointer for the given dataset
|
long |
getSize(String fileName)
Returns the current size of the file in question
|
boolean |
hasFile(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(ds.funnel.data.format.FormatWriter mFormat) |
int |
read(String filename,
byte[] bytesToRead)
Attempts to read a set of bytes from the underlying file.
|
int |
read(String fileName,
ByteBuffer readBuffer)
Attempts to read a set of bytes from the underlying file.
|
void |
removeFile(String fileName)
Removes a file from this dataset.
|
void |
setPosition(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(String fileName,
byte[] bytesToWrite)
Writes a byte[] to a give file.
|
int |
write(String fileName,
ByteBuffer writeBuffer)
Write the specified Buffer to the file corresponding to the specified
file.
|
public FileDatasetImpl(ds.funnel.data.format.FormatReader mFormat) throws IOException, DatasetException
IOException
DatasetException
public void marshall(ds.funnel.data.format.FormatWriter mFormat)
marshall
in interface ds.funnel.data.format.FormatMarshaller
public Dataset.DatasetType getDatasetType()
Dataset
getDatasetType
in interface Dataset
public String getDescription()
Dataset
getDescription
in interface Dataset
public String getDatasetIdentifier()
Dataset
getDatasetIdentifier
in interface Dataset
public boolean isInitialized()
Dataset
isInitialized
in interface Dataset
true
if the dataset is initialized;
false
otherwise.public boolean initializeDataset() throws DatasetException
Dataset
initializeDataset
in interface Dataset
true
if the dataset has been initialized;
false
otherwise.DatasetException
public boolean isAvailable()
Dataset
isAvailable
in interface Dataset
true
if the dataset is available;
false
otherwise.public boolean isDataAvailable()
Dataset
isDataAvailable
in interface Dataset
true
if data is available on this dataset;
false
otherwise.public long getLastModificationTime()
Dataset
getLastModificationTime
in interface Dataset
public boolean supportsDataAvailabilityNotifications()
Dataset
supportsDataAvailabilityNotifications
in interface Dataset
true
if this dataset supports data availability
notifications;false
otherwise.public DataAvailabilityNotifier getDataAvailabilityNotifier()
Dataset
getDataAvailabilityNotifier
in interface Dataset
public long getSize(String fileName) throws DatasetException
FileDataset
getSize
in interface FileDataset
fileName
- The name of the fileDatasetException
- If there are problems retrieving the FileChannel corresponding
to the filepublic long getPosition(String fileName) throws DatasetException
FileDataset
getPosition
in interface FileDataset
fileName
- The name of the file.DatasetException
- If there are problems retrieving the FileChannel corresponding
to the filepublic void setPosition(String fileName, long newPosition) throws DatasetException
FileDataset
setPosition
in interface FileDataset
fileName
- The filenewPosition
- The new position for the pointerDatasetException
- If there are problems retrieving the FileChannel corresponding
to the filepublic int read(String filename, byte[] bytesToRead) throws DatasetException
FileDataset
read
in interface FileDataset
filename
- The file to be readbytesToRead
- The byte[] to be read intoDatasetException
- If there are problems retrieving the FileChannel
corresponding to the filepublic int read(String fileName, ByteBuffer readBuffer) throws DatasetException
FileDataset
read
in interface FileDataset
fileName
- The file to be readreadBuffer
- The buffer to be read intoDatasetException
- If there are problems retrieving the FileChannel
corresponding to the filepublic int write(String fileName, byte[] bytesToWrite) throws DatasetException
FileDataset
write
in interface FileDataset
fileName
- 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(String fileName, ByteBuffer writeBuffer) throws DatasetException
FileDataset
write
in interface FileDataset
fileName
- 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(String fileName, String mode) throws DatasetException
FileDataset
addFile
in interface FileDataset
fileName
- The name of the filemode
- The permissions associated with this fileDatasetException
- If there are problems adding this filepublic void removeFile(String fileName) throws DatasetException
FileDataset
removeFile
in interface FileDataset
fileName
- The name of the fileDatasetException
- If there are problems removing this filepublic boolean hasFile(String fileName)
FileDataset
hasFile
in interface FileDataset
fileName
- The name of the filetrue
if the file is a part of the dataset;
false
otherwise.public Collection<String> getFiles()
FileDataset
getFiles
in interface FileDataset
public boolean close() throws DatasetException
Dataset
close
in interface Dataset
true
if a graceful closure of this dataset was
performed;false
otherwise.DatasetException
Copyright © 2015. All rights reserved.