org.mozilla.jrex.io
Class JRexInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.mozilla.jrex.io.JRexInputStream

public class JRexInputStream
extends InputStream

JRexInputStream is java wrapper arround native nsIInputStream.

Version:
1.0
Author:
C.N.Medappa

Constructor Summary
JRexInputStream(long streamPeer)
          Creates a JRexInputStream given peer stream handle.
 
Method Summary
 int available()
          Returns the number of bytes that can be read from this native inputstream without blocking.
 void close()
          Closes this input stream and releases any system resources associated with the stream.
protected  void finalize()
          Ensures that the close method of this input stream is called when there are no more references to it.
 void mark(int readlimit)
          Mark is not supported, hence this function does nothing.
 boolean markSupported()
          Mark is not supported.
 int read()
          Reads a byte of data from this input stream.
 int read(byte[] buff)
          Reads up to b.length bytes of data from this input stream into an array of bytes.
 int read(byte[] buff, int off, int len)
          Reads up to buff.length bytes of data from this input stream into an array of bytes.
 void reset()
          Since mark is not supported, this throws IOException.
 long skip(long n)
          skip is not supported, hence return -1.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRexInputStream

public JRexInputStream(long streamPeer)
                throws JRexException
Creates a JRexInputStream given peer stream handle.

Parameters:
streamPeer - handle to the native nsIInputStream instance
Throws:
JRexException - if streamPeer is invalid.
Method Detail

available

public int available()
              throws IOException
Returns the number of bytes that can be read from this native inputstream without blocking.

Returns:
the number of bytes that can be read from this native inputstream without blocking.
Throws:
IOException - if an I/O error or JRexException occurs.

read

public int read()
         throws IOException
Reads a byte of data from this input stream. This method blocks if no input is yet available.

Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error or JRexException occurs.

read

public int read(byte[] buff,
                int off,
                int len)
         throws IOException
Reads up to buff.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Parameters:
buff - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
IOException - if an I/O error or JRexException occurs.

read

public int read(byte[] buff)
         throws IOException
Reads up to b.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Parameters:
buff - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
IOException - if an I/O error or JRexException occurs.

mark

public void mark(int readlimit)
Mark is not supported, hence this function does nothing.


reset

public void reset()
           throws IOException
Since mark is not supported, this throws IOException.

Throws:
IOException

skip

public long skip(long n)
          throws IOException
skip is not supported, hence return -1.

Throws:
IOException

markSupported

public boolean markSupported()
Mark is not supported.


close

public void close()
           throws IOException
Closes this input stream and releases any system resources associated with the stream.

Throws:
IOException - if an I/O error or JRexException occurs.

finalize

protected void finalize()
                 throws IOException
Ensures that the close method of this input stream is called when there are no more references to it.

Throws:
IOException
See Also:
close()


Copyright © 2004 C.N.Medappa. All Rights Reserved.