com.bluemarsh.jswat
Class FileSource
java.lang.Object
|
+--com.bluemarsh.jswat.FileSource
- All Implemented Interfaces:
- SourceSource
- public class FileSource
- extends java.lang.Object
- implements SourceSource
Class FileSource is a concrete implementation of SourceSource
in which the source is backed by a java.io.File
instance.
- Author:
- Nathan Fiedler
Field Summary |
protected java.io.File |
fileSource
The file that is the source of the source. |
Constructor Summary |
FileSource(java.io.File src)
Constructs a FileSource object for the given File. |
FileSource(java.lang.String name)
Construct a FileSource using the given path and filename. |
Method Summary |
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one. |
java.io.InputStream |
getInputStream()
Get the input stream for reading the source code. |
java.lang.String |
getName()
Returns just the name of the source file, not including the path
to the file, if any. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileSource
protected java.io.File fileSource
- The file that is the source of the source.
FileSource
public FileSource(java.lang.String name)
- Construct a FileSource using the given path and filename.
- Parameters:
name
- path and filename.- Throws:
java.lang.IllegalArgumentException
- if name is null.
FileSource
public FileSource(java.io.File src)
- Constructs a FileSource object for the given File.
- Parameters:
src
- file source.- Throws:
java.lang.IllegalArgumentException
- if src is null.
equals
public boolean equals(java.lang.Object o)
- Indicates whether some other object is "equal to" this one.
- Overrides:
equals
in class java.lang.Object
- Parameters:
o
- the reference object with which to compare.- Returns:
- true if this object is the same as the obj argument;
false otherwise.
getName
public java.lang.String getName()
- Returns just the name of the source file, not including the path
to the file, if any.
- Specified by:
getName
in interface SourceSource
- Returns:
- name of source.
getInputStream
public java.io.InputStream getInputStream()
- Get the input stream for reading the source code. This may
fail, in which case it will return a
null
.
- Specified by:
getInputStream
in interface SourceSource
- Returns:
- input stream to the source code, or null if error.