org.activemq.streams
Class JMSInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.activemq.streams.JMSInputStream
All Implemented Interfaces:
Closeable

public class JMSInputStream
extends InputStream

An inputStream that reads data from a MessageConsumer

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  ByteArray[] arrays
           
protected  int clen
           
 
Constructor Summary
JMSInputStream(MessageConsumer consumer)
          Construct an input stream to read from a JMS Consumer
 
Method Summary
 int available()
          Return the number of bytes available for reading.
 void close()
          close the stream and the MessageConsumer
 void mark(int readlimit)
          Set the stream's mark to the current position.
 boolean markSupported()
           
 int read()
          Read the next byte from this stream.
 int read(byte[] b)
          Read data from this input stream into the given byte array starting at offset 0 for b.length bytes.
 int read(byte[] b, int off, int len)
          Read data from this input stream into the given byte array starting at offset 'off' for 'len' bytes.
 void reset()
          Returns the stream to the position of the previous mark().
 long skip(long length)
          Skip n bytes in this stream; returns the number of bytes actually skipped (which may be less than the number requested).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arrays

protected ByteArray[] arrays

clen

protected int clen
Constructor Detail

JMSInputStream

public JMSInputStream(MessageConsumer consumer)
Construct an input stream to read from a JMS Consumer

Parameters:
consumer -
Method Detail

read

public int read()
         throws IOException
Read the next byte from this stream.

Specified by:
read in class InputStream
Returns:
the next byte
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Read data from this input stream into the given byte array starting at offset 0 for b.length bytes. Returns the actual number of bytes read;

Overrides:
read in class InputStream
Parameters:
b -
Returns:
the number of bytes read
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Read data from this input stream into the given byte array starting at offset 'off' for 'len' bytes. Returns the actual number of bytes read.

Overrides:
read in class InputStream
Parameters:
b - buffer to read data into
off - offset into b
len - the maximum length
Returns:
the number of bytes actually read
Throws:
IOException

skip

public long skip(long length)
          throws IOException
Skip n bytes in this stream; returns the number of bytes actually skipped (which may be less than the number requested).

Overrides:
skip in class InputStream
Parameters:
length - the number of bytes to skip
Returns:
the number of bytes actually skipped
Throws:
IOException

available

public int available()
              throws IOException
Return the number of bytes available for reading.

Overrides:
available in class InputStream
Returns:
the number of bytes available
Throws:
IOException

close

public void close()
close the stream and the MessageConsumer

Specified by:
close in interface Closeable
Overrides:
close in class InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream
Returns:
true

reset

public void reset()
           throws IOException
Returns the stream to the position of the previous mark().

Overrides:
reset in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)
Set the stream's mark to the current position.

Overrides:
mark in class InputStream
Parameters:
readlimit -


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.