org.mozilla.jrex.io
Class JRexInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--org.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(int 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(int 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.

Overrides:
available in class InputStream
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.

Specified by:
read in class InputStream
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.

Overrides:
read in class InputStream
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.

Overrides:
read in class InputStream
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.

Overrides:
mark in class InputStream

reset

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

Overrides:
reset in class InputStream
IOException

skip

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

Overrides:
skip in class InputStream
IOException

markSupported

public boolean markSupported()
Mark is not supported.

Overrides:
markSupported in class InputStream

close

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

Overrides:
close in class InputStream
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.

Overrides:
finalize in class Object
IOException
See Also:
close()


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