edu.rit.pj.cluster
Class BackendFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- edu.rit.pj.cluster.BackendFileInputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
public class BackendFileInputStream extends java.io.InputStreamClass 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Close this input stream.intread()Read a byte from this input stream.intread(byte[] buf)Read the given byte array from this input stream.intread(byte[] buf, int off, int len)Read a portion of the given byte array from this input stream.longskip(long len)Skip the given number of bytes from this input stream.
-
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionRead a byte from this input stream. The byte is returned as an int in the range 0 .. 255.- Specified by:
readin classjava.io.InputStream- Returns:
- Byte, or -1 if the end-of-stream was encountered.
- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
read
public int read(byte[] buf) throws java.io.IOExceptionRead the given byte array from this input stream.- Overrides:
readin classjava.io.InputStream- Parameters:
buf- Byte array.- Returns:
- Number of bytes actually read, or -1 if the end-of-stream was encountered.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if buf is null.java.io.IOException- Thrown if an I/O error occurred.
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOExceptionRead a portion of the given byte array from this input stream.- Overrides:
readin classjava.io.InputStream- Parameters:
buf- Byte array.off- Index of first byte to read.len- Number of bytes to read.- Returns:
- Number of bytes actually read, or -1 if the end-of-stream was encountered.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if buf is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if off < 0, len < 0, or off+len > buf.length.java.io.IOException- Thrown if an I/O error occurred.
-
skip
public long skip(long len) throws java.io.IOExceptionSkip the given number of bytes from this input stream.- Overrides:
skipin classjava.io.InputStream- Parameters:
len- Number of bytes to skip.- Returns:
- Number of bytes actually skipped.
- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
close
public void close() throws java.io.IOExceptionClose this input stream.- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
-
DMelt 3.0 © DataMelt by jWork.ORG