org.apache.activemq
Class ActiveMQInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.activemq.ActiveMQInputStream
All Implemented Interfaces:
Closeable, ActiveMQDispatcher

public class ActiveMQInputStream
extends InputStream
implements ActiveMQDispatcher


Nested Class Summary
 class ActiveMQInputStream.ReadTimeoutException
          Exception which should get thrown if the first chunk of the stream could not read within the configured timeout
 
Constructor Summary
ActiveMQInputStream(ActiveMQConnection connection, ConsumerId consumerId, ActiveMQDestination dest, String selector, boolean noLocal, String name, int prefetch, long timeout)
           
 
Method Summary
protected  void checkClosed()
           
 void close()
           
 void dispatch(MessageDispatch md)
           
 void dispose()
           
 Map<String,Object> getJMSProperties()
          Return the JMS Properties which where used to send the InputStream
 int read()
           
 int read(byte[] b, int off, int len)
           
 ActiveMQMessage receive()
          This method allows the client to receive the Stream data as unaltered ActiveMQMessage object which is how the split stream data is sent.
 String toString()
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActiveMQInputStream

public ActiveMQInputStream(ActiveMQConnection connection,
                           ConsumerId consumerId,
                           ActiveMQDestination dest,
                           String selector,
                           boolean noLocal,
                           String name,
                           int prefetch,
                           long timeout)
                    throws JMSException
Throws:
JMSException
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

dispose

public void dispose()

getJMSProperties

public Map<String,Object> getJMSProperties()
                                    throws IOException
Return the JMS Properties which where used to send the InputStream

Returns:
jmsProperties
Throws:
IOException

receive

public ActiveMQMessage receive()
                        throws JMSException,
                               ActiveMQInputStream.ReadTimeoutException
This method allows the client to receive the Stream data as unaltered ActiveMQMessage object which is how the split stream data is sent. Each message will contains one chunk of the written bytes as well as a valid message group sequence id. The EOS message will have a message group sequence id of -1. This method is useful for testing, but should never be mixed with calls to the normal stream receive methods as it will break the normal stream processing flow and can lead to loss of data.

Returns:
an ActiveMQMessage object that either contains byte data or an end of strem marker.
Throws:
JMSException
ActiveMQInputStream.ReadTimeoutException

checkClosed

protected void checkClosed()
                    throws IllegalStateException
Throws:
IllegalStateException

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
ActiveMQInputStream.ReadTimeoutException - if a timeout was given and the first chunk of the message could not read within the timeout
IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
ActiveMQInputStream.ReadTimeoutException - if a timeout was given and the first chunk of the message could not read within the timeout
IOException
See Also:
InputStream.read(byte[], int, int)

dispatch

public void dispatch(MessageDispatch md)
Specified by:
dispatch in interface ActiveMQDispatcher

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.