org.apache.activemq
Class ActiveMQInputStream
java.lang.Object
java.io.InputStream
org.apache.activemq.ActiveMQInputStream
- All Implemented Interfaces:
- Closeable, ActiveMQDispatcher
public class ActiveMQInputStream
- extends InputStream
- implements ActiveMQDispatcher
ActiveMQInputStream
public ActiveMQInputStream(ActiveMQConnection connection,
ConsumerId consumerId,
ActiveMQDestination dest,
String selector,
boolean noLocal,
String name,
int prefetch,
long timeout)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
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 javax.jms.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:
javax.jms.JMSException
ActiveMQInputStream.ReadTimeoutException
checkClosed
protected void checkClosed()
throws javax.jms.IllegalStateException
- Throws:
javax.jms.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.