Package edu.rit.pj.cluster
Class BackendFileInputStream
java.lang.Object
java.io.InputStream
edu.rit.pj.cluster.BackendFileInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Class BackendFileInputStream provides an object in a job backend process that
reads a sequential file in the job frontend process. A backend file input
stream is not constructed directly, rather it is created by a factory method
in class BackendFileReader.
Note: Class BackendFileInputStream 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 BackendFileInputStream.
- Version:
- 20-Nov-2006
- Author:
- Alan Kaminsky
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this input stream.int
read()
Read a byte from this input stream.int
read
(byte[] buf) Read the given byte array from this input stream.int
read
(byte[] buf, int off, int len) Read a portion of the given byte array from this input stream.long
skip
(long len) Skip the given number of bytes from this input stream.Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Method Details
-
read
Read a byte from this input stream. The byte is returned as anint
in the range 0 .. 255.- Specified by:
read
in classInputStream
- Returns:
- a int.
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
read
Read the given byte array from this input stream.- Overrides:
read
in classInputStream
- Parameters:
buf
- Byte array.- Returns:
- Number of bytes actually read, or -1 if the end-of-stream was encountered.
- Throws:
NullPointerException
- (unchecked exception) Thrown ifbuf
is null.IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
read
Read a portion of the given byte array from this input stream.- Overrides:
read
in classInputStream
- Throws:
NullPointerException
- (unchecked exception) Thrown ifbuf
is null.IndexOutOfBoundsException
- (unchecked exception) Thrown ifoff
< 0,len
< 0, oroff+len
>buf.length
.IOException
- Thrown if an I/O error occurred.
-
skip
Skip the given number of bytes from this input stream.- Overrides:
skip
in classInputStream
- Throws:
IOException
- Thrown if an I/O error occurred.
-
close
Close this input stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-