Class OpenFileInputStream

java.lang.Object
com.nt.udc.ei.transport.OpenFileInputStream

public class OpenFileInputStream extends Object
This class is used for open file input stream.
Since:
JDK 1.2.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected File
     
     
    protected com.nt.common.util.PosFileInputStream
     
    protected boolean
     
    protected long
     
    protected long
     
    protected long
    Time awaiting for next set of data
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpenFileInputStream(File file, boolean isActive, long timeout)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this open file input stream.
    long
    Get current read position.
    void
    mark(int readAheadLimit)
    Marks the current position in the open file input stream.
    int
    read(byte[] buffer)
    Reads bytes from this open file input stream.
    int
    read(byte[] buffer, int offset, int count)
    Reads "count" bytes from the open file input stream starting at the current read position and stores the bytes read into byte array "buffer" starting at index "offset".
    void
     
    void
    Repositions the stream to the last marked position.
    long
    skip(long count)
    Skips bytes from this file input stream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m_inputStream

      protected com.nt.common.util.PosFileInputStream m_inputStream
    • m_br

      protected BufferedInputStream m_br
    • m_fr

      protected InputStreamReader m_fr
    • m_isActive

      protected boolean m_isActive
    • m_file

      protected File m_file
    • m_mark

      protected long m_mark
    • m_pos

      protected long m_pos
    • m_timeout

      protected long m_timeout
      Time awaiting for next set of data
  • Constructor Details

  • Method Details

    • reload

      public void reload() throws Exception
      Throws:
      Exception
    • close

      public void close() throws IOException
      Closes this open file input stream.
      Throws:
      IOException
    • getFilePos

      public long getFilePos()
      Get current read position.
    • mark

      public void mark(int readAheadLimit) throws IOException
      Marks the current position in the open file input stream.
      Parameters:
      readAheadLimit - The maximum read-ahead allowed before the current mark is invalidated.
      Throws:
      IOException
    • read

      public int read(byte[] buffer) throws IOException
      Reads bytes from this open file input stream. It reads at most buffer.length number of bytes.
      Parameters:
      buffer - The buffer into which the data is read.
      Returns:
      The actual number of bytes read. Return -1 if end-of-file has been reached before any bytes have been read.
      Throws:
      IOException
    • read

      public int read(byte[] buffer, int offset, int count) throws IOException
      Reads "count" bytes from the open file input stream starting at the current read position and stores the bytes read into byte array "buffer" starting at index "offset".
      Parameters:
      buffer - The buffer into which the data is read.
      offset - The index in buffer in which to start storing the bytes read.
      count - The maximum number of bytes to read.
      Returns:
      The actual number of bytes read. Return -1 if end-of-file has been reached before any bytes have been read.
      Throws:
      IOException
    • reset

      public void reset() throws IOException
      Repositions the stream to the last marked position.
      Throws:
      IOException
    • skip

      public long skip(long count) throws IOException
      Skips bytes from this file input stream
      Returns:
      The actual number of bytes skipped.
      Throws:
      IOException