Class DisBitSet
java.lang.Object
java.util.BitSet
edu.nps.moves.dis7.pdus.DisBitSet
- All Implemented Interfaces:
Marshaller
,Serializable
,Cloneable
- Direct Known Subclasses:
AirPlatformAppearance
,AirPlatformCapabilities
,ArealObjectAppearanceMinefield
,CulturalFeatureAppearance
,CulturalFeatureCapabilities
,DEDamageDescriptionComponentVisualDamageStatus
,DEFireFlags
,EnvironmentalAppearance
,EnvironmentalCapabilities
,EnvironmentalProcessEnvironmentStatus
,ExpendableAppearance
,ExpendableCapabilities
,LandPlatformAppearance
,LandPlatformCapabilities
,LifeFormsAppearance
,LifeFormsCapabilities
,LinearObjectAppearanceBreach
,LinearObjectAppearanceExhaustSmoke
,LinearObjectAppearanceMinefieldLaneMarker
,LinearObjectAppearanceSpeedBump
,LinearObjectAppearanceTankDitchAndConcertinaWire
,LinearObjectAppearanceWire
,MinefieldDataFusing
,MinefieldDataPaintScheme
,MinefieldStateAppearanceBitMap
,MunitionAppearance
,MunitionCapabilities
,NonHumanLifeFormsAppearance
,ObjectStateAppearanceGeneral
,ObjectStateModificationArealObject
,ObjectStateModificationLinearObject
,ObjectStateModificationPointObject
,PointObjectAppearanceAirGroundBurst
,PointObjectAppearanceBuildingRubble
,PointObjectAppearanceBuildingStructure
,PointObjectAppearanceCrater
,PointObjectAppearanceDisturbedEarthRoad
,PointObjectAppearanceLogCribAbatisEtAl
,PointObjectAppearancePothole
,PointObjectAppearanceRibbonBridge
,PointObjectAppearanceStationaryBridgeAndAVLB
,PointObjectAppearanceTree
,RadioAppearance
,RadioCapabilities
,SensorEmitterAppearance
,SensorEmitterCapabilities
,SpacePlatformAppearance
,SpacePlatformCapabilities
,StopFreezeFrozenBehavior
,SubsurfacePlatformAppearance
,SubsurfacePlatformCapabilities
,SupplyAppearance
,SupplyCapabilities
,SurfacePlatformAppearance
,SurfacePlatformCapabilities
,UAPropulsionPlantConfiguration
This class is backed by a Java library class,
BitSet
. That class exports its
byte array contents in little-endian order (least significant byte first). The DIS spec requires
the opposite, which is the default for "network byte order".- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static int
calculateMask
(int length) Calculate bit maskprotected static int
calculateMask
(int position, int length) Calculate bit maskint
Returns size of this serialized (marshalled) object in bytesvoid
marshal
(DataOutputStream dos) Marshal value to DataOutputStreamvoid
marshal
(ByteBuffer byteBuffer) Marshal value to ByteBufferbyte[]
Marshal value to ByteBufferprotected void
setbits
(int position, int length, int value) Accessor method to set bitsint
unmarshal
(DataInputStream dis) Deserializes an object from a DataInputStream.int
unmarshal
(ByteBuffer byteBuffer) Deserializes an object from a ByteBuffer.Methods inherited from class java.util.BitSet
and, andNot, cardinality, clear, clear, clear, clone, equals, flip, flip, get, get, hashCode, intersects, isEmpty, length, nextClearBit, nextSetBit, or, previousClearBit, previousSetBit, set, set, set, set, size, stream, toByteArray, toLongArray, toString, valueOf, valueOf, valueOf, valueOf, xor
-
Constructor Details
-
DisBitSet
public DisBitSet(int length) Constructor- Parameters:
length
- number of bits
-
-
Method Details
-
calculateMask
protected static int calculateMask(int position, int length) Calculate bit mask- Parameters:
position
- in this DisBitSetlength
- number of bits- Returns:
- bit mask
-
calculateMask
protected static int calculateMask(int length) Calculate bit mask- Parameters:
length
- number of bits- Returns:
- bit mask
-
setbits
protected void setbits(int position, int length, int value) Accessor method to set bits- Parameters:
position
- in this DisBitSetlength
- number of bitsvalue
- value of bits to set
-
getMarshalledSize
public int getMarshalledSize()Returns size of this serialized (marshalled) object in bytes- Specified by:
getMarshalledSize
in interfaceMarshaller
- Returns:
- serialized size in bytes
- See Also:
-
marshal
Marshal value to DataOutputStream- Specified by:
marshal
in interfaceMarshaller
- Parameters:
dos
- DataOutputStream for output- See Also:
-
marshal
Marshal value to ByteBuffer- Specified by:
marshal
in interfaceMarshaller
- Parameters:
byteBuffer
- ByteBuffer for output- See Also:
-
marshallCommon
public byte[] marshallCommon()Marshal value to ByteBuffer- Returns:
- Little-Endian byte array, network byte order requires reverse
- See Also:
-
unmarshal
Deserializes an object from a DataInputStream.- Specified by:
unmarshal
in interfaceMarshaller
- Parameters:
dis
- DataInputStream- Returns:
- marshalled serialized size in bytes
- See Also:
-
unmarshal
Deserializes an object from a ByteBuffer.- Specified by:
unmarshal
in interfaceMarshaller
- Parameters:
byteBuffer
- input- Returns:
- marshalled serialized size in bytes
- See Also:
-