CADI.Common.LogicalTarget.JPEG2000.File
Class ReadJP2File

java.lang.Object
  extended by CADI.Common.LogicalTarget.JPEG2000.File.ReadJP2File
All Implemented Interfaces:
JP2BoxIdentifiers

public class ReadJP2File
extends java.lang.Object
implements JP2BoxIdentifiers

This class reads a JP2 file.

Version:
1.1 2008/10/07
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  int fileFormat
          Definition in JP2LogicalTarget.fileFormatType
private  BufferedDataInputStream in
          Is an object with the input stream where the main header is read from.
private  boolean jp2HeaderBoxFound
          Indicates whether the JP2 header box has been found.
private  JPCParameters jpcParameters
          Is an object where the main header are saved.
private  long mainHeaderInitialPos
          Is the file pointer to the first byte of the main header.
private  int mainHeaderLength
          Is the length of the main header.
 
Fields inherited from interface CADI.Common.LogicalTarget.JPEG2000.File.JP2BoxIdentifiers
BITS_PER_COMPONENT_BOX_TYPE, CAPTURE_RESOLUTION_BOX_TYPE, CHANNEL_DEFINITION_BOX_TYPE, COLOR_SPECIFICATION_BOX_TYPE, COMPONENT_MAPPING_BOX_TYPE, CONTIGUOUS_CODESTREAM_BOX_TYPE, DEFAULT_DISPLAY_RESOLUTION_BOX_TYPE, FILE_TYPE_BOX_BRAND, FILE_TYPE_BOX_TYPE, IMAGE_HEADER_BOX_TYPE, INTELLECTUAL_PROPERTY_BOX_TYPE, JP2_HEADER_BOX_TYPE, PALETTE_BOX_TYPE, RESOLUTION_BOX_TYPE, SIGNATURE_BOX_CONTENT, SIGNATURE_BOX_LENGTH, SIGNATURE_BOX_TYPE, UUID_BOX_TYPE, UUID_INFO_BOX_TYPE, XML_BOX_TYPE
 
Constructor Summary
ReadJP2File(BufferedDataInputStream in)
          Constructor.
 
Method Summary
 int getFileFormat()
          Returns the fileFormat attribute.
 JPCParameters getJPCParameters()
          Returns the jpcParameters attribute.
 long getMainHeaderInitialPos()
          Returns the mainHeaderInitialPos attribute.
 int getMainHeaderLength()
          Returns the mainHeaderLength attribute.
private  void readContiguousCodestreamBox(long length)
          Reads the Contiguous Codestream Box and checks its conformity.
private  void readIntPropertyBox(long length)
           
private  void readUUIDBox(long length)
           
private  void readUUIDInfoBox(long length)
           
private  void readXMLBox(long length)
           
 void run()
          Reads the boxes of the JP2 headers and checks their conformity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private BufferedDataInputStream in
Is an object with the input stream where the main header is read from.


jpcParameters

private JPCParameters jpcParameters
Is an object where the main header are saved.


mainHeaderInitialPos

private long mainHeaderInitialPos
Is the file pointer to the first byte of the main header.


mainHeaderLength

private int mainHeaderLength
Is the length of the main header.


fileFormat

private int fileFormat
Definition in JP2LogicalTarget.fileFormatType


jp2HeaderBoxFound

private boolean jp2HeaderBoxFound
Indicates whether the JP2 header box has been found.

Constructor Detail

ReadJP2File

public ReadJP2File(BufferedDataInputStream in)
Constructor.

Parameters:
in - input stream where data will be read from.
Method Detail

run

public void run()
         throws ErrorException,
                java.io.EOFException,
                java.io.IOException
Reads the boxes of the JP2 headers and checks their conformity.

Throws:
ErrorException - when the header information is ambiguous or incorrect
java.io.EOFException
java.io.IOException

getFileFormat

public int getFileFormat()
Returns the fileFormat attribute.

Returns:
the fileFormat attribute.

getJPCParameters

public JPCParameters getJPCParameters()
Returns the jpcParameters attribute.

Returns:
the jpcParameters attribute.

getMainHeaderInitialPos

public long getMainHeaderInitialPos()
Returns the mainHeaderInitialPos attribute.

Returns:
the mainHeaderInitialPos attribute.

getMainHeaderLength

public int getMainHeaderLength()
Returns the mainHeaderLength attribute.

Returns:
the mainHeaderLength attribute.

readContiguousCodestreamBox

private void readContiguousCodestreamBox(long length)
                                  throws ErrorException
Reads the Contiguous Codestream Box and checks its conformity.

Throws:
ErrorException - when the header information is ambiguous or incorrect

readIntPropertyBox

private void readIntPropertyBox(long length)
                         throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readXMLBox

private void readXMLBox(long length)
                 throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readUUIDBox

private void readUUIDBox(long length)
                  throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readUUIDInfoBox

private void readUUIDInfoBox(long length)
                      throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException


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)