jigcell.compare.impl
Class RawFileDataSource

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by jigcell.compare.impl.Transferer
          extended by jigcell.compare.impl.DataSource
              extended by jigcell.compare.impl.FileDataSource
                  extended by jigcell.compare.impl.RawFileDataSource
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, IDataSource, IMultipleDataSource, IPersistableDataSource, IReadableDataSource, IWriteableDataSource
Direct Known Subclasses:
XMLFileDataSource

public class RawFileDataSource
extends FileDataSource

A transfer agent that supports reading and writing data to a regular file.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jigcell.compare.impl.FileDataSource
FileDataSource.IFileEncoder
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Field Summary
 
Fields inherited from class jigcell.compare.impl.FileDataSource
DEFAULT_FILECHOOSER, DESCRIPTION_READ, DESCRIPTION_WRITE, MESSAGE_BADDIRECTORYERROR, OPTION_ENCODER, OPTION_EXCEPTIONLISTENER, OPTION_FILECHOOSER, OPTION_FILECHOOSER_SELECT, OPTION_FILEINPUT, OPTION_FILEOUTPUT, OPTION_FILEPATH
 
Fields inherited from class jigcell.compare.impl.DataSource
OPTIONS_LOCK, SEPARATOR_PAIR, SEPARATOR_PART, SEPARATORS
 
Fields inherited from class jigcell.compare.impl.Transferer
CSV_FOOTER, CSV_LINEPOSTPEND, CSV_LINEPREPEND, CSV_LINESEPARATOR, HTML_FOOTER, HTML_HEADPOSTPEND, HTML_HEADPREPEND, HTML_HEADSEPARATOR, HTML_LINEPOSTPEND, HTML_LINEPREPEND, HTML_LINESEPARATOR
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Fields inherited from interface jigcell.compare.IReadableDataSource
OPTION_READDESCRIPTION, OPTION_READICON
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Fields inherited from interface jigcell.compare.IWriteableDataSource
OPTION_WRITEDESCRIPTION, OPTION_WRITEICON
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Constructor Summary
RawFileDataSource()
          Creates a new data source that represents a file.
RawFileDataSource(java.lang.String path)
          Creates a new data source that represents a file.
 
Method Summary
protected  java.io.InputStream createFileInput(java.lang.String path)
          Creates an input stream for a file.
protected  java.io.OutputStream createFileOutput(java.lang.String path)
          Creates an output stream for a file.
 java.lang.Object getOption(java.lang.String key)
          A configuration option.
protected  void initializeSource()
          Performs any initialization work for the view that must be duplicated for each new instance.
 
Methods inherited from class jigcell.compare.impl.FileDataSource
configure, finish, getEncoderOption, getException, getExceptionListenerOption, getExceptionRecorder, getFileChooserOption, getFileChooserSelectOption, getFileInputOption, getFileOutputOption, getFilePathOption, getLocation, getPredictedCompatibility, getPredictedCompatibility, getPredictedContents, read, setEncoderOption, setExceptionListenerOption, setFileChooserOption, setFileChooserSelectOption, setFileInputOption, setFileOutputOption, setFilePathOption, setLocation, write
 
Methods inherited from class jigcell.compare.impl.DataSource
addOption, addPropertyChangeListener, addPropertyChangeListener, clone, getName, getOptions, getOptionType, getPropertyChangeListeners, getPropertyChangeListeners, getReadDescriptionOption, getReadIconOption, getState, getWriteDescriptionOption, getWriteIconOption, persistSource, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setName, setOption, setOptions, setOptionType, setReadDescriptionOption, setReadIconOption, setState, setWriteDescriptionOption, setWriteIconOption, toString, unpersistSource
 
Methods inherited from class jigcell.compare.impl.Transferer
addExtension, addFlavor, createCSVTable, createFormattedTable, createHTMLTable, getExpectedClasses, getExpectedClasses, getExpectedClasses, getFlavors, getFlavors, getPreferredExtensions, getPreferredExtensions, getTransferClass, getTransferData, getTransferDataFlavors, getTransferFlavor, isDataFlavorSupported, transfer
 
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getSourceActions, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, getName, getState, setOption, setState
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, getName, getState, setOption, setState
 
Methods inherited from interface jigcell.compare.IReadableDataSource
getReadDescriptionOption, getReadIconOption, setReadDescriptionOption, setReadIconOption
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, getName, getState, setOption, setState
 
Methods inherited from interface jigcell.compare.IWriteableDataSource
getWriteDescriptionOption, getWriteIconOption, setWriteDescriptionOption, setWriteIconOption
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, getName, getState, setOption, setState
 

Constructor Detail

RawFileDataSource

public RawFileDataSource()
Creates a new data source that represents a file.


RawFileDataSource

public RawFileDataSource(java.lang.String path)
Creates a new data source that represents a file.

Parameters:
path - File path
Method Detail

getOption

public java.lang.Object getOption(java.lang.String key)
A configuration option.

Specified by:
getOption in interface IDataSource
Overrides:
getOption in class DataSource
Parameters:
key - Option name

createFileInput

protected java.io.InputStream createFileInput(java.lang.String path)
                                       throws java.io.IOException
Creates an input stream for a file. An exclusive lock for the file will be obtained. Since the lock is not returned, the stream must be closed to free the lock.

Specified by:
createFileInput in class FileDataSource
Parameters:
path - Path to file
Throws:
java.io.IOException

createFileOutput

protected java.io.OutputStream createFileOutput(java.lang.String path)
                                         throws java.io.IOException
Creates an output stream for a file. An exclusive lock for the file will be obtained. Since the lock is not returned, the stream must be closed to free the lock. All necessary directories for the file will be created if they do not already exist.

Specified by:
createFileOutput in class FileDataSource
Parameters:
path - Path to file
Throws:
java.io.IOException

initializeSource

protected void initializeSource()
Performs any initialization work for the view that must be duplicated for each new instance. This method is called exactly once and only during object construction.

Overrides:
initializeSource in class DataSource