RECODER 0.92

recoder.io
Class DataFileLocation

java.lang.Object
  extended by recoder.io.DataFileLocation
All Implemented Interfaces:
DataLocation

public class DataFileLocation
extends java.lang.Object
implements DataLocation

This class implements a data location that describes aJava source code file.

Author:
RN, AL

Field Summary
static java.lang.String LOCATION_TYPE_FILE
           
 
Constructor Summary
DataFileLocation(java.io.File f)
          Creates a new data file location for the specified file.
DataFileLocation(java.lang.String filename)
           
 
Method Summary
 boolean equals(java.lang.Object ob)
           
 java.io.File getFile()
           
 java.io.InputStream getInputStream()
          returns an input stream for the content of the location
 java.io.OutputStream getOutputStream()
          returns an output stream for manipulating the content of the location
 java.io.Reader getReader()
          returns a reader for the according data content.
 java.lang.String getType()
          returns a string representation of the locationType
 java.io.Writer getWriter()
          returns a writer for the according data content.
 int hashCode()
           
 boolean hasReaderSupport()
          determines whether the data source provides a reader interface.
 boolean hasWriterSupport()
          determines whether the data source provides a writer interface.
 void inputStreamClosed()
          tells the location, that the earlier created input stream has been closed
 boolean isWritable()
          determines whether or not the data location can be overwritten.
 void outputStreamClosed()
          tells the location, that the earlier created output stream has been closed
 void readerClosed()
          tells the location, that the earlier created reader has been closed
 java.lang.String toString()
          returns a URL-like string representation of the location in the form " : ", i.e. file:/bin/sh url:http://mywww/myfile zip:recoder.zip:recoder/java/JavaProgramFactory.class
 void writerClosed()
          tells the location, that the earlier created writer has been closed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCATION_TYPE_FILE

public static final java.lang.String LOCATION_TYPE_FILE
See Also:
Constant Field Values
Constructor Detail

DataFileLocation

public DataFileLocation(java.io.File f)
Creates a new data file location for the specified file. The file might be changed to its canonical form.


DataFileLocation

public DataFileLocation(java.lang.String filename)
Method Detail

getType

public java.lang.String getType()
returns a string representation of the locationType

Specified by:
getType in interface DataLocation

getFile

public java.io.File getFile()

toString

public java.lang.String toString()
returns a URL-like string representation of the location in the form " : ", i.e. file:/bin/sh url:http://mywww/myfile zip:recoder.zip:recoder/java/JavaProgramFactory.class

Specified by:
toString in interface DataLocation
Overrides:
toString in class java.lang.Object

hasReaderSupport

public boolean hasReaderSupport()
determines whether the data source provides a reader interface. If this is not the case, the reader is placed on top of an input stream, which causes efficiency losses.

Specified by:
hasReaderSupport in interface DataLocation
Returns:
true iff the data location provides reader functionality

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
returns an input stream for the content of the location

Specified by:
getInputStream in interface DataLocation
Returns:
the according input stream
Throws:
java.io.IOException - thrown if an error occurs with retrieving the input stream from the according data object.

inputStreamClosed

public void inputStreamClosed()
tells the location, that the earlier created input stream has been closed

Specified by:
inputStreamClosed in interface DataLocation

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
returns a reader for the according data content. If the data source does not provide a reader, an adapter reader is placed on top of an input stream.

Specified by:
getReader in interface DataLocation
Returns:
the according reader
Throws:
java.io.IOException - thrown if an error occurs with retrieving the reader or the underlying input stream from the according data object.

readerClosed

public void readerClosed()
tells the location, that the earlier created reader has been closed

Specified by:
readerClosed in interface DataLocation

isWritable

public boolean isWritable()
determines whether or not the data location can be overwritten.

Specified by:
isWritable in interface DataLocation
Returns:
true if writing is supported

hasWriterSupport

public boolean hasWriterSupport()
determines whether the data source provides a writer interface. If this is not the case, the writer is placed on top of an output stream, which causes efficiency losses.

Specified by:
hasWriterSupport in interface DataLocation
Returns:
true iff the data location provides writer functionality

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
returns an output stream for manipulating the content of the location

Specified by:
getOutputStream in interface DataLocation
Returns:
the according output stream
Throws:
java.io.IOException - thrown if an error occurs with retrieving the output stream from the according data object.

outputStreamClosed

public void outputStreamClosed()
tells the location, that the earlier created output stream has been closed

Specified by:
outputStreamClosed in interface DataLocation

getWriter

public java.io.Writer getWriter()
                         throws java.io.IOException
returns a writer for the according data content. If the data source does not provide a writer, an adapter reader is placed on top of an output stream.

Specified by:
getWriter in interface DataLocation
Returns:
the according writer
Throws:
java.io.IOException - thrown if an error occurs with retrieving the writer or the underlying output stream from the according data object.

writerClosed

public void writerClosed()
tells the location, that the earlier created writer has been closed

Specified by:
writerClosed in interface DataLocation

equals

public boolean equals(java.lang.Object ob)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

RECODER 0.92