ucar.jpeg.jj2000.j2k.image
Class DataBlkByte

java.lang.Object
  extended by ucar.jpeg.jj2000.j2k.image.DataBlk
      extended by ucar.jpeg.jj2000.j2k.image.DataBlkByte

public class DataBlkByte
extends DataBlk

This is an implementation of the DataBlk interface for a byte

The methods in this class are declared final, so that they can be inlined by inlining compilers.

See Also:
DataBlk

Field Summary
 byte[] data
          The array where the data is stored
 
Fields inherited from class ucar.jpeg.jj2000.j2k.image.DataBlk
h, offset, progressive, scanw, TYPE_BYTE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, ulx, uly, w
 
Constructor Summary
DataBlkByte()
          Creates a DataBlkByte with 0 dimensions and no data array (i.e.
DataBlkByte(DataBlkByte src)
          Copy constructor.
DataBlkByte(int ulx, int uly, int w, int h)
          Creates a DataBlkByte with the specified dimensions and position.
 
Method Summary
 Object getData()
          Returns the array containing the data, or null if there is no data array.
 byte[] getDataByte()
          Returns the array containing the data, or null if there is no data array.
 int getDataType()
          Returns the identifier of this data type, TYPE_BYTE, as defined in DataBlk.
 void setData(Object arr)
          Sets the data array to the specified one.
 void setDataByte(byte[] arr)
          Sets the data array to the specified one.
 String toString()
          Returns a string of informations about the DataBlkByte.
 
Methods inherited from class ucar.jpeg.jj2000.j2k.image.DataBlk
getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

public byte[] data
The array where the data is stored

Constructor Detail

DataBlkByte

public DataBlkByte()
Creates a DataBlkByte with 0 dimensions and no data array (i.e. data is null).


DataBlkByte

public DataBlkByte(int ulx,
                   int uly,
                   int w,
                   int h)
Creates a DataBlkByte with the specified dimensions and position. The data array is initialized to an array of size w*h.

Parameters:
ulx - The horizontal coordinate of the upper-left corner of the block
uly - The vertical coordinate of the upper-left corner of the block
w - The width of the block (in pixels)
h - The height of the block (in pixels)

DataBlkByte

public DataBlkByte(DataBlkByte src)
Copy constructor. Creates a DataBlkByte which is the copy of the DataBlkByte given as paramter.

Parameters:
DataBlkByte - the object to be copied.
Method Detail

getDataType

public final int getDataType()
Returns the identifier of this data type, TYPE_BYTE, as defined in DataBlk.

Specified by:
getDataType in class DataBlk
Returns:
The type of data stored. Always DataBlk.TYPE_BYTE
See Also:
DataBlk.TYPE_BYTE

getData

public final Object getData()
Returns the array containing the data, or null if there is no data array. The returned array is a byte array.

Specified by:
getData in class DataBlk
Returns:
The array of data (a byte[]) or null if there is no data.
See Also:
DataBlk.getDataType()

getDataByte

public final byte[] getDataByte()
Returns the array containing the data, or null if there is no data array.

Returns:
The array of data or null if there is no data.

setData

public final void setData(Object arr)
Sets the data array to the specified one. The provided array must be a byte array, otherwise a ClassCastException is thrown. The size of the array is not checked for consistency with the block's dimensions.

Specified by:
setData in class DataBlk
Parameters:
arr - The data array to use. Must be a byte array.
See Also:
DataBlk.getDataType()

setDataByte

public final void setDataByte(byte[] arr)
Sets the data array to the specified one. The size of the array is not checked for consistency with the block's dimensions. This method is more efficient than setData

Parameters:
arr - The data array to use.

toString

public String toString()
Returns a string of informations about the DataBlkByte.

Overrides:
toString in class DataBlk
Returns:
Block dimensions and progressiveness in a string


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.