|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Server.LogicalTarget.JPEG2000.Codestream.PacketHeadersEncoder
public class PacketHeadersEncoder
This class implements the packet headers encoder. This class is implemented to store only information of those packets which have been initialize, so only information about these packets will be required.
Before any call to the encodePacketHeader(long, int[][][][]) method
(to encode the packet header of a precinct) is is necessary the
setZeroBitPlanesAndFirstLayer(long, int[][][], int[][][]) method
had been called in order to set the first layer and number of zero bit
planes for this precinct. Otherwise, an exception will be thrown.
Each call to the encodePacketHeader(long, int[][][][]) method
generates the packet header belonging to the next quality layer for
the precinct passed as the first function's parameter.
Usage: example:
construct
[setParameters]
setZeroBitPlanesAndFirstLayer
encodePacketHeader
| Field Summary | |
|---|---|
private boolean |
emptyHeaderBit
It refers to the zero length packet coding (empty packets). |
int[][][] |
firstLayer
Definition in PacketHeaderDataEncoder.firstLayer. |
private int[][][] |
lBlock
Definition in PacketHeaderDataEncoder.lBlock. |
private PacketHeaderDataOutputStream |
packetHeaderDataOutputStream
ByteStream to built each packet header |
private java.util.Map<java.lang.Long,PacketHeaderDataEncoder> |
packetHeaders
This object is used to save the packet headers data objects. |
private TagTreeEncoder[] |
TTInclusionInformation
Definition in PacketHeaderDataEncoder.TTInclusionInformation. |
private TagTreeEncoder[] |
TTZeroBitPlanes
Definition in PacketHeaderDataEncoder.TTZeroBitPlanes. |
| Constructor Summary | |
|---|---|
PacketHeadersEncoder()
Constructor. |
|
PacketHeadersEncoder(boolean emptyHeaderBit)
Constructor. |
|
| Method Summary | |
|---|---|
private void |
encodeCodingPasses(int value)
Gives a codeword to the value. |
private int |
encodeLengths(int lblock,
int[] dataCodingPasses)
Calculate and codify the Lblock value and length of codeword segment |
byte[] |
encodePacketHeader(long inClassIdentifier,
int[][][][] codingPassesAdded)
Encodes the packet header data in a byte array for the precinct which is referenced to as layer - component - resolution level - precinct, and whose coding passed are passed in the codingPassesAdded
variable. |
int |
getLastEncodedLayer(long inClassIdentifier)
Returns the last encoded layer. |
byte[] |
getPacketHeaderBuffer()
Returns a byte array with the las packet header which has been encoded. |
int |
getPacketHeaderLength()
Returns the length of the last encoded packet (in bytes). |
boolean |
isSet(long inClassIdentifier)
Check whether zero bit planes and first layer has been set for a precinct. |
void |
list(java.io.PrintStream out)
Prints the Packet Headers Encoder data out to the specified output stream. |
void |
reset()
Sets attributes to its initial values. |
void |
setParameters(boolean emptyHeaderBit)
Set the emptyHeaderBit attribute. |
void |
setZeroBitPlanesAndFirstLayer(long inClassIdentifier,
int[][][] zeroBitPlanes,
int[][][] firstLayer)
Sets the zero bit planes and first layer for a precinct. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private boolean emptyHeaderBit
private java.util.Map<java.lang.Long,PacketHeaderDataEncoder> packetHeaders
JPIPMessageHeader.inClassIdentifier)
as a key.
private PacketHeaderDataOutputStream packetHeaderDataOutputStream
private TagTreeEncoder[] TTInclusionInformation
PacketHeaderDataEncoder.TTInclusionInformation.
private TagTreeEncoder[] TTZeroBitPlanes
PacketHeaderDataEncoder.TTZeroBitPlanes.
private int[][][] lBlock
PacketHeaderDataEncoder.lBlock.
public int[][][] firstLayer
PacketHeaderDataEncoder.firstLayer.
| Constructor Detail |
|---|
public PacketHeadersEncoder()
public PacketHeadersEncoder(boolean emptyHeaderBit)
emptyHeaderBit - definition in emptyHeaderBit.| Method Detail |
|---|
public void setParameters(boolean emptyHeaderBit)
emptyHeaderBit attribute.
emptyHeaderBit - definition in emptyHeaderBit.
public void setZeroBitPlanesAndFirstLayer(long inClassIdentifier,
int[][][] zeroBitPlanes,
int[][][] firstLayer)
throws ErrorException
This method must be used only when objects are build using the default
constructor. Moreover, it has to be called once before the
#encodePacketHeader(long, int, int, int, int[][][][]) method
was called for each precinct.
If it is called more than once, an exception will be thrown. Therefore,
in order to avoid it, it is recommended to perform a call to the
isSet(long) method to check if state data has been set.
zeroBitPlanes - firstLayer -
ErrorExceptionpublic boolean isSet(long inClassIdentifier)
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
true if data has been set. Otherwise, returns
false.
public byte[] encodePacketHeader(long inClassIdentifier,
int[][][][] codingPassesAdded)
throws ErrorException,
java.lang.IllegalAccessException
codingPassesAdded
variable.
The buffer where the packet header are encoded can be retrieved through
the getPacketHeaderBuffer method.
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.codingPassesAdded - is a multi-dimensional array with the lengths
of each coding-pass which will be included in this packet.
Indexes means:ErrorException - when an error ocurrs in PacketHeadingCoding
java.lang.IllegalAccessExceptionpublic void reset()
public byte[] getPacketHeaderBuffer()
getLastPacketHeaderLength method.
public int getPacketHeaderLength()
public int getLastEncodedLayer(long inClassIdentifier)
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
public java.lang.String toString()
toString in class java.lang.Objectpublic void list(java.io.PrintStream out)
out - an output stream.
private void encodeCodingPasses(int value)
throws ErrorException,
java.io.IOException
value - value to be coded.
ErrorException - when passed value is not valid
java.io.IOException
private int encodeLengths(int lblock,
int[] dataCodingPasses)
throws java.io.IOException
lblock - current valuedataCodingPasses - bytes contributed to a packet by the code-block
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||