Package org.apache.activemq.openwire
Class OpenWireFormat
- java.lang.Object
-
- org.apache.activemq.openwire.OpenWireFormat
-
- All Implemented Interfaces:
WireFormat
public final class OpenWireFormat extends Object implements WireFormat
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_LEGACY_VERSIONstatic longDEFAULT_MAX_FRAME_SIZEstatic intDEFAULT_STORE_VERSIONstatic intDEFAULT_WIRE_VERSION
-
Constructor Summary
Constructors Constructor Description OpenWireFormat()OpenWireFormat(int i)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShortaddToMarshallCache(DataStructure o)OpenWireFormatcopy()booleanequals(Object object)DataStructuregetFromUnmarshallCache(short index)ShortgetMarshallCacheIndex(DataStructure o)longgetMaxFrameSize()WireFormatInfogetPreferedWireFormatInfo()intgetVersion()inthashCode()booleanisCacheEnabled()booleanisMaxFrameSizeEnabled()booleanisSizePrefixDisabled()booleanisStackTraceEnabled()booleanisTcpNoDelayEnabled()booleanisTightEncodingEnabled()voidlooseMarshalNestedObject(DataStructure o, DataOutput dataOut)DataStructurelooseUnmarshalNestedObject(DataInput dis)ByteSequencemarshal(Object command)Packet based marshalingvoidmarshal(Object o, DataOutput dataOut)Stream based marshalingprotected intmin(int version1, int version2)protected longmin(long version1, long version2)voidrenegotiateWireFormat(WireFormatInfo info)voidrunMarshallCacheEvictionSweep()voidsetCacheEnabled(boolean cacheEnabled)voidsetInUnmarshallCache(short index, DataStructure o)voidsetMaxFrameSize(long maxFrameSize)voidsetMaxFrameSizeEnabled(boolean maxFrameSizeEnabled)Set whether the maxFrameSize check will be enabled.voidsetPreferedWireFormatInfo(WireFormatInfo info)voidsetSizePrefixDisabled(boolean prefixPacketSize)voidsetStackTraceEnabled(boolean b)voidsetTcpNoDelayEnabled(boolean tcpNoDelayEnabled)voidsetTightEncodingEnabled(boolean tightEncodingEnabled)voidsetVersion(int version)Allows you to dynamically switch the version of the openwire protocol being used.inttightMarshal1(Object o, BooleanStream bs)Used by NIO or AIO transportsvoidtightMarshal2(Object o, DataOutput ds, BooleanStream bs)Used by NIO or AIO transports; note that the size is not written as part of this method.inttightMarshalNestedObject1(DataStructure o, BooleanStream bs)voidtightMarshalNestedObject2(DataStructure o, DataOutput ds, BooleanStream bs)DataStructuretightUnmarshalNestedObject(DataInput dis, BooleanStream bs)StringtoString()Objectunmarshal(DataInput dis)Packet based un-marshalingObjectunmarshal(ByteSequence sequence)Packet based un-marshaling
-
-
-
Field Detail
-
DEFAULT_STORE_VERSION
public static final int DEFAULT_STORE_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_WIRE_VERSION
public static final int DEFAULT_WIRE_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_LEGACY_VERSION
public static final int DEFAULT_LEGACY_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_MAX_FRAME_SIZE
public static final long DEFAULT_MAX_FRAME_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
public OpenWireFormat copy()
-
getVersion
public int getVersion()
- Specified by:
getVersionin interfaceWireFormat- Returns:
- the version of the wire format
-
marshal
public ByteSequence marshal(Object command) throws IOException
Description copied from interface:WireFormatPacket based marshaling- Specified by:
marshalin interfaceWireFormat- Throws:
IOException
-
unmarshal
public Object unmarshal(ByteSequence sequence) throws IOException
Description copied from interface:WireFormatPacket based un-marshaling- Specified by:
unmarshalin interfaceWireFormat- Throws:
IOException
-
marshal
public void marshal(Object o, DataOutput dataOut) throws IOException
Description copied from interface:WireFormatStream based marshaling- Specified by:
marshalin interfaceWireFormat- Throws:
IOException
-
unmarshal
public Object unmarshal(DataInput dis) throws IOException
Description copied from interface:WireFormatPacket based un-marshaling- Specified by:
unmarshalin interfaceWireFormat- Throws:
IOException
-
tightMarshal1
public int tightMarshal1(Object o, BooleanStream bs) throws IOException
Used by NIO or AIO transports- Throws:
IOException
-
tightMarshal2
public void tightMarshal2(Object o, DataOutput ds, BooleanStream bs) throws IOException
Used by NIO or AIO transports; note that the size is not written as part of this method.- Throws:
IOException
-
setVersion
public void setVersion(int version)
Allows you to dynamically switch the version of the openwire protocol being used.- Specified by:
setVersionin interfaceWireFormat- Parameters:
version-
-
tightMarshalNestedObject1
public int tightMarshalNestedObject1(DataStructure o, BooleanStream bs) throws IOException
- Throws:
IOException
-
tightMarshalNestedObject2
public void tightMarshalNestedObject2(DataStructure o, DataOutput ds, BooleanStream bs) throws IOException
- Throws:
IOException
-
tightUnmarshalNestedObject
public DataStructure tightUnmarshalNestedObject(DataInput dis, BooleanStream bs) throws IOException
- Throws:
IOException
-
looseUnmarshalNestedObject
public DataStructure looseUnmarshalNestedObject(DataInput dis) throws IOException
- Throws:
IOException
-
looseMarshalNestedObject
public void looseMarshalNestedObject(DataStructure o, DataOutput dataOut) throws IOException
- Throws:
IOException
-
runMarshallCacheEvictionSweep
public void runMarshallCacheEvictionSweep()
-
getMarshallCacheIndex
public Short getMarshallCacheIndex(DataStructure o)
-
addToMarshallCache
public Short addToMarshallCache(DataStructure o)
-
setInUnmarshallCache
public void setInUnmarshallCache(short index, DataStructure o)
-
getFromUnmarshallCache
public DataStructure getFromUnmarshallCache(short index)
-
setStackTraceEnabled
public void setStackTraceEnabled(boolean b)
-
isStackTraceEnabled
public boolean isStackTraceEnabled()
-
isTcpNoDelayEnabled
public boolean isTcpNoDelayEnabled()
-
setTcpNoDelayEnabled
public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled)
-
isCacheEnabled
public boolean isCacheEnabled()
-
setCacheEnabled
public void setCacheEnabled(boolean cacheEnabled)
-
isTightEncodingEnabled
public boolean isTightEncodingEnabled()
-
setTightEncodingEnabled
public void setTightEncodingEnabled(boolean tightEncodingEnabled)
-
isSizePrefixDisabled
public boolean isSizePrefixDisabled()
-
setSizePrefixDisabled
public void setSizePrefixDisabled(boolean prefixPacketSize)
-
setPreferedWireFormatInfo
public void setPreferedWireFormatInfo(WireFormatInfo info)
-
getPreferedWireFormatInfo
public WireFormatInfo getPreferedWireFormatInfo()
-
getMaxFrameSize
public long getMaxFrameSize()
-
setMaxFrameSize
public void setMaxFrameSize(long maxFrameSize)
-
isMaxFrameSizeEnabled
public boolean isMaxFrameSizeEnabled()
-
setMaxFrameSizeEnabled
public void setMaxFrameSizeEnabled(boolean maxFrameSizeEnabled)
Set whether the maxFrameSize check will be enabled. Note this is only applied to this format and will NOT be negotiated- Parameters:
maxFrameSizeEnabled-
-
renegotiateWireFormat
public void renegotiateWireFormat(WireFormatInfo info) throws IOException
- Throws:
IOException
-
min
protected int min(int version1, int version2)
-
min
protected long min(long version1, long version2)
-
-