CADI.Common.Cache
Class DataBin

java.lang.Object
  extended by CADI.Common.Cache.DataBin
All Implemented Interfaces:
ClassIdentifiers

public class DataBin
extends java.lang.Object
implements ClassIdentifiers

This class implements a DataBin such as it is defined in the ISO/IEC 15444-9.

Version:
1.0 2007/12/23
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
 int classIdentifier
          Definition in JPIPMessageHeader.classIdentifier Allowed values, see ClassIdentifiers.
 boolean complete
          An array list which indicates whether all data for this precinct has been received.
 java.util.ArrayList<byte[]> data
          One-dimensional array with the data of the data-bin.
 long inClassIdentifier
          Definition in JPIPMessageHeader.inClassIdentifier
 java.util.ArrayList<java.lang.Integer> numCompletedPackets
          An array list which indicates the last full layer achieved with the data stored in the dataBin array list.
 java.util.ArrayList<java.lang.Long> offsets
          Definition in JPIPMessageHeader.msgOffset NOTE: This parameters will be deprecated.
 
Fields inherited from interface CADI.Common.Network.JPIP.ClassIdentifiers
EXTENDED_PRECINCT, EXTENDED_TILE, MAIN_HEADER, METADATA, PRECINCT, TILE, TILE_HEADER
 
Constructor Summary
DataBin(int classIdentifier, long inClassIdentifier)
          Constructor.
 
Method Summary
 void addStream(byte[] data, long offset, boolean complete, int numCompletedPackets)
          Adds a precinct data-bin message to the cache.
 void addStreamBak(byte[] data, long offset, boolean complete, int numCompletedPackets)
          Deprecated.  
 byte[] getDataArray()
           
 long getLength()
          Returns the length of the stored data.
 int getNumCompletedPackets()
           
 void list(java.io.PrintStream out)
          Prints this DataBin out to the specified output stream.
 void listData(java.io.PrintStream out)
          Prints this DataBin out to the specified output stream.
 void reset()
          Set attributes to its initial values.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classIdentifier

public int classIdentifier
Definition in JPIPMessageHeader.classIdentifier

Allowed values, see ClassIdentifiers.


inClassIdentifier

public long inClassIdentifier
Definition in JPIPMessageHeader.inClassIdentifier


data

public java.util.ArrayList<byte[]> data
One-dimensional array with the data of the data-bin.


offsets

public java.util.ArrayList<java.lang.Long> offsets
Definition in JPIPMessageHeader.msgOffset

NOTE: This parameters will be deprecated.


numCompletedPackets

public java.util.ArrayList<java.lang.Integer> numCompletedPackets
An array list which indicates the last full layer achieved with the data stored in the dataBin array list. A value of 0 indicates that either there is not data saved for this precinct or the server does not signal the layer which data belongs (i.e. Aux parameter in jpip message header is not used).

Definition in JPIPMessageHeader.Aux


complete

public boolean complete
An array list which indicates whether all data for this precinct has been received.

Definition in JPIPMessageHeader.isLastByte

Constructor Detail

DataBin

public DataBin(int classIdentifier,
               long inClassIdentifier)
Constructor.

Parameters:
inClassIdentifier - definition in inClassIdentifier.
Method Detail

addStream

public void addStream(byte[] data,
                      long offset,
                      boolean complete,
                      int numCompletedPackets)
Adds a precinct data-bin message to the cache.

This method can only be used when there were no gaps between consecutive message data. Otherwise, and exception is thrown.

Parameters:
data - definition in JPIPMessage.messageBody
offset - definition in JPIPMessageHeader.msgOffset
complete - definition in JPIPMessageHeader.isLastByte
numCompletedPackets - the last full layer (if this information is provived). Otherwise, it is 0.

addStreamBak

public void addStreamBak(byte[] data,
                         long offset,
                         boolean complete,
                         int numCompletedPackets)
Deprecated. 

Adds a precinct data-bin message to the cache.

Parameters:
data - definition in JPIPMessage.messageBody
offset - definition in JPIPMessageHeader.msgOffset
complete - definition in JPIPMessageHeader.isLastByte
numCompletedPackets - the last full layer (if this information is provived). Otherwise, it is 0.

getNumCompletedPackets

public int getNumCompletedPackets()
Returns:

getLength

public long getLength()
Returns the length of the stored data.

Returns:

getDataArray

public byte[] getDataArray()
Returns:

reset

public void reset()
Set attributes to its initial values.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

list

public void list(java.io.PrintStream out)
Prints this DataBin out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.

listData

public void listData(java.io.PrintStream out)
Prints this DataBin out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)