|
Sun Java(tm) System Message Queue v4.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.messaging.jmq.io.ReadOnlyPacket
public class ReadOnlyPacket
This class is a mostly immutable encapsulation of a JMQ packet. It is only "mostly" immutable because it can be modified by calling the readPacket() method which modifies the state of the object to reflect the packet just read. WARNING! This class emphasizes performance over safety. In particular the readPacket() method is NOT synchronized. You must only call readPacket() in a single threaded environment (or do the synchronization yourself). Once the object is initialized via a readPacket() you can safely use the accessors and the writePacket() methods in a multi-threaded envornment.
| Field Summary | |
|---|---|
protected int |
bitFlags
|
protected long |
consumerID
|
protected String |
correlationID
|
static short |
defaultVersion
|
protected String |
destination
|
protected String |
destinationClass
|
protected int |
encryption
|
protected long |
expiration
|
protected static int |
HEADER_SIZE
|
protected byte[] |
headerBuffer
|
protected int |
magic
|
static int |
MAGIC
|
protected String |
messageID
|
protected String |
messageType
|
protected int |
packetSize
|
protected int |
packetType
|
protected int |
priority
|
protected long |
producerID
|
protected Hashtable |
properties
|
protected int |
propertyOffset
|
protected int |
propertySize
|
protected String |
replyTo
|
protected String |
replyToClass
|
protected byte[] |
ropBuffer
|
protected int |
ropLength
|
protected boolean |
stringsParsed
|
protected SysMessageID |
sysMessageID
|
protected long |
transactionID
|
protected int |
version
|
static short |
VERSION1
|
static short |
VERSION2
|
static short |
VERSION3
|
| Constructor Summary | |
|---|---|
ReadOnlyPacket()
|
|
| Method Summary | |
|---|---|
Object |
clone()
Make a deep copy of this packet. |
Object |
cloneShallow()
Make a shallow copy of this packet. |
void |
dump(PrintStream os)
Dump the contents of the packet in human readable form to the specified OutputStream. |
boolean |
getConsumerFlow()
|
long |
getConsumerID()
|
String |
getCorrelationID()
|
String |
getDestination()
|
String |
getDestinationClass()
|
int |
getEncryption()
|
long |
getExpiration()
|
boolean |
getFlag(int flag)
|
boolean |
getFlowPaused()
|
boolean |
getIndempotent()
|
int |
getInterestID()
|
byte[] |
getIP()
|
String |
getIPString()
|
boolean |
getIsLast()
|
boolean |
getIsQueue()
|
boolean |
getIsTransacted()
|
int |
getMagic()
|
int |
getMessageBodySize()
Return the size of the message body in bytes |
InputStream |
getMessageBodyStream()
Return an InputStream that contains the contents of the message body. |
String |
getMessageID()
Get the MessageID for the packet. |
String |
getMessageType()
|
int |
getPacketSize()
|
int |
getPacketType()
|
boolean |
getPersistent()
|
int |
getPort()
|
int |
getPriority()
|
long |
getProducerID()
|
Hashtable |
getProperties()
Return the property hashtable for this packet. |
int |
getPropertyOffset()
|
int |
getPropertySize()
|
boolean |
getRedelivered()
|
String |
getReplyTo()
|
String |
getReplyToClass()
|
boolean |
getSelectorsProcessed()
|
boolean |
getSendAcknowledge()
|
int |
getSequence()
|
SysMessageID |
getSysMessageID()
Get the system message ID. |
long |
getTimestamp()
|
long |
getTransactionID()
|
int |
getVersion()
|
boolean |
isEqual(SysMessageID id)
Check if this packet matches the specified system message id. |
void |
readPacket(InputStream is)
Read packet from an InputStream. |
protected void |
reset()
Reset packet to initial values |
void |
retryReadPacket(InputStream is)
Attempt to complete the reading of a packet. |
static void |
setDefaultVersion(short version)
this method MUST be called before a packet is created |
String |
toString()
Return a unique string that identifies the packet |
String |
toVerboseString()
Return a string containing the contents of the packet in a human readable form. |
void |
writePacket(OutputStream os)
Write the packet to an OutputStream |
void |
writePacket(OutputStream os,
int new_version)
Write the packet to an OutputStream |
void |
writePacket(OutputStream os,
int new_version,
long new_consumerID,
boolean new_pauseFlow,
boolean new_redelivered,
boolean new_lastPkt)
Write the packet to an OutputStream with some modified fields. |
void |
writePacket(OutputStream os,
long new_consumerID,
boolean new_pauseFlow,
boolean new_redelivered,
boolean new_lastPkt)
Write the packet to an OutputStream with some modified fields. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAGIC
public static final short VERSION1
public static final short VERSION2
public static final short VERSION3
public static short defaultVersion
protected static final int HEADER_SIZE
protected byte[] headerBuffer
protected byte[] ropBuffer
protected int ropLength
protected int version
protected int magic
protected int packetType
protected int packetSize
protected long expiration
protected int propertyOffset
protected int propertySize
protected int encryption
protected long transactionID
protected int priority
protected int bitFlags
protected long consumerID
protected SysMessageID sysMessageID
protected String destination
protected String destinationClass
protected String messageID
protected String correlationID
protected String replyTo
protected String replyToClass
protected String messageType
protected long producerID
protected boolean stringsParsed
protected Hashtable properties
| Constructor Detail |
|---|
public ReadOnlyPacket()
| Method Detail |
|---|
public static void setDefaultVersion(short version)
public void readPacket(InputStream is)
throws IOException,
EOFException,
StreamCorruptedException,
IllegalArgumentException
is - the InputStream to read the packet from
IOException
EOFException
StreamCorruptedException
IllegalArgumentException
public void retryReadPacket(InputStream is)
throws IOException,
EOFException,
StreamCorruptedException,
IllegalArgumentException
IOException
EOFException
StreamCorruptedException
IllegalArgumentExceptionpublic boolean getFlag(int flag)
public void writePacket(OutputStream os)
throws IOException
os - The OutputStream to write the packet to
IOException
public void writePacket(OutputStream os,
int new_version)
throws IOException
os - The OutputStream to write the packet to
IOException
public void writePacket(OutputStream os,
long new_consumerID,
boolean new_pauseFlow,
boolean new_redelivered,
boolean new_lastPkt)
throws IOException
os - The OutputStream to write the packet tonew_consumerID - New value for the consumerIDnew_pauseFlow - New value for the pause flow flag (F bit)new_redelivered - New value for the redelivered flag (R bit)new_lastPkt - New value for the last message flag (L bit)
IOException
public void writePacket(OutputStream os,
int new_version,
long new_consumerID,
boolean new_pauseFlow,
boolean new_redelivered,
boolean new_lastPkt)
throws IOException
os - The OutputStream to write the packet tonew_version - New version valuenew_consumerID - New value for the consumerIDnew_pauseFlow - New value for the pause flow flag (F bit)new_redelivered - New value for the redelivered flag (R bit)new_lastPkt - New value for the last message flag (L bit)
IOExceptionpublic boolean isEqual(SysMessageID id)
public int getVersion()
public int getMagic()
public int getPacketType()
public int getPacketSize()
public long getTimestamp()
public long getExpiration()
public int getPort()
public String getIPString()
public byte[] getIP()
public int getSequence()
public int getPropertyOffset()
public int getPropertySize()
public int getEncryption()
public int getPriority()
public long getTransactionID()
public long getProducerID()
public long getConsumerID()
public int getInterestID()
public boolean getPersistent()
public boolean getRedelivered()
public boolean getIsQueue()
public boolean getSelectorsProcessed()
public boolean getSendAcknowledge()
public boolean getIsLast()
public boolean getFlowPaused()
public boolean getIsTransacted()
public boolean getConsumerFlow()
public boolean getIndempotent()
public String getDestination()
public String getDestinationClass()
public String getMessageID()
public String getCorrelationID()
public String getReplyTo()
public String getReplyToClass()
public String getMessageType()
public SysMessageID getSysMessageID()
WARNING! This returns a references to the Packet's SysMessageID not a copy.
public int getMessageBodySize()
public InputStream getMessageBodyStream()
public Hashtable getProperties()
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundExceptionprotected void reset()
public Object cloneShallow()
public Object clone()
clone in class Objectpublic String toString()
toString in class Objectpublic String toVerboseString()
public void dump(PrintStream os)
os - OutputStream to write packet contents to
|
Sun Java(tm) System Message Queue v4.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||