Class BackendFileReader

java.lang.Object
edu.rit.pj.cluster.BackendFileReader

public class BackendFileReader extends Object
Class BackendFileReader provides an object that reads sequential files in the job backend process.

Note: Class BackendFileReader is not multiple thread safe; it assumes it is being called by a synchronized method in the job backend.

Version:
20-Nov-2006
Author:
Alan Kaminsky
  • Field Details

    • in

      public final BackendFileInputStream in
      Input stream for reading from the job frontend's standard input.
  • Constructor Details

    • BackendFileReader

      public BackendFileReader(JobFrontendRef theJobFrontend, JobBackendRef theJobBackend)
      Construct a new backend file reader.
      Parameters:
      theJobFrontend - Job Frontend.
      theJobBackend - Job Backend.
  • Method Details

    • open

      public BackendFileInputStream open(File file) throws IOException
      Open a backend file input stream on the given file.
      Parameters:
      file - File.
      Returns:
      Backend file input stream.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • inputFileOpenResult

      public void inputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc)
      Report the result of opening the given input file.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      bfd - Backend file descriptor.
      ffd - Frontend file descriptor if success.
      exc - Null if success, exception if failure.
    • inputFileReadResult

      public void inputFileReadResult(JobFrontendRef theJobFrontend, int ffd, int len, IOException exc)
      Report the result of reading the given input file.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      len - Number of bytes read, or -1 if EOF.
      exc - Null if success, exception if failure.
    • inputFileSkipResult

      public void inputFileSkipResult(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc)
      Report the result of skipping the given input file.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      len - Number of bytes skipped.
      exc - Null if success, exception if failure.
    • inputFileCloseResult

      public void inputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc)
      Report the result of closing the given input file.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      exc - Null if success, exception if failure.