Class StreamFile
- Version:
- 06-Nov-2006
- Author:
- Alan Kaminsky
-
Constructor Summary
ConstructorDescriptionStreamFile
(File theFile) Construct a new stream file that refers to the given file in the frontend processor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if this stream file is equal to the given object.getFile()
Obtain the file in the frontend processor to which this stream file refers.Open an input stream for reading this stream file.Open an output stream for writing this stream file.getOutputStream
(boolean append) Open an output stream for writing this stream file.int
hashCode()
Returns a hash code for this stream file.toString()
Returns a string version of this stream file.
-
Constructor Details
-
StreamFile
Construct a new stream file that refers to the given file in the frontend processor.- Parameters:
theFile
- File.- Throws:
NullPointerException
- (unchecked exception) Thrown iftheFile
is null.
-
-
Method Details
-
getFile
Obtain the file in the frontend processor to which this stream file refers.- Returns:
- File.
-
getOutputStream
Open an output stream for writing this stream file. If the file does not exist, it is created; if the file exists, it is overwritten.When called from a job backend process in a cluster parallel program, the returned output stream communicates with the job frontend process to write the file in the frontend processor. Otherwise, the returned output stream is a normal file output stream to write the file directly.
Note: The returned output stream does not do any buffering. Each method call sends a message to and receives a message from the job frontend. Consider layering a BufferedOutputStream on top of the returned output stream.
- Returns:
- Output stream.
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
getOutputStream
Open an output stream for writing this stream file. If the file does not exist, it is created; if the file exists and theappend
flag is false, the file is overwritten; if the file exists and theappend
flag is true, data is written after the end of the file.When called from a job backend process in a cluster parallel program, the returned output stream communicates with the job frontend process to write the file in the frontend processor. Otherwise, the returned output stream is a normal file output stream to write the file directly.
Note: The returned output stream does not do any buffering. Each method call sends a message to and receives a message from the job frontend. Consider layering a BufferedOutputStream on top of the returned output stream.
- Parameters:
append
- True to append, false to overwrite.- Returns:
- Output stream.
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
getInputStream
Open an input stream for reading this stream file.When called from a job backend process in a cluster parallel program, the returned input stream communicates with the job frontend process to read the file in the frontend processor. Otherwise, the returned input stream is a normal file input stream to read the file directly.
Note: The returned input stream does not do any buffering. Each method call sends a message to and receives a message from the job frontend. Consider layering a BufferedInputStream on top of the returned input stream.
- Returns:
- Input stream.
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
equals
Determine if this stream file is equal to the given object. -
hashCode
public int hashCode()Returns a hash code for this stream file. -
toString
Returns a string version of this stream file.
-