|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.tree.DefaultMutableTreeNode PIRL.PVL.Parameter PIRL.Image_Tools.JPEG2000_Info
public class JPEG2000_Info
JPEG2000_Info is a Parameter Aggregate describing a file of JPEG2000 information.
This class is intended to be the base class for JP2_Info and JPEG2000_Codestream_Info Parameter sets. The JPEG2000_Info methods know how to manage the assigned ImageInputStream to obtain data values and keep track of the stream position, but it expects its subclasses to know how to use the data values to generate the appropriate Parameters.
JP2_Info
,
JPEG2000_Codestream_Info
,
Serialized FormField Summary | |
---|---|
static int |
BITS_VARIABLE
Value of a bit precision Parameter value when the number of bits is variable. |
static String |
DATA_LENGTH_PARAMETER
Parameter name for specifying the length (bytes) of a data block. |
static String |
DATA_OFFSET_PARAMETER
Parameter name for specifying a data block offset in an enclosing object. |
static String |
DATA_POSITION_PARAMETER
Parameter name for specifying the position of data in the Source file (byte offset from the beginning of the file). |
static String |
ID
Class identification name with source code version and date. |
protected ImageInputStream |
Image_Input_Stream
The ImageInputStream Source from which the JPEG2000 information is obtained. |
static String |
LENGTH_PARAMETER
Generic parameter names used by both JP2_Info and JPEG20000_Codestream_Info |
static String |
POSITION_PARAMETER
Generic parameter names used by both JP2_Info and JPEG20000_Codestream_Info |
protected boolean |
Skip_Tiles
Flag for skipping tile segments. |
static boolean |
Skip_Tiles_Default
Default flag for skipping tile segments. |
protected long |
Stream_Position
The current read position of the Source file. |
protected boolean |
Throw_Illegal_State
Flag for throwing an IllegalStateException when the Source is found to contain an invalid box or segment organization or contents. |
static boolean |
Throw_Illegal_State_Default
Default flag for throwing an IllegalStateException when the Source is found to contain an invalid box or segment organization or contents. |
static String |
TOTAL_COMPONENTS_PARAMETER
Generic parameter names used by both JP2_Info and JPEG20000_Codestream_Info |
static String |
UNKNOWN
|
protected boolean |
Use_Data_Position
Flag for using data
position parameters in preference to data offset
parameters . |
static boolean |
Use_Data_Position_Default
Default flag for using data position parameters in preference to data offset
parameters . |
static String |
VALUE_BITS_PARAMETER
Parameter name for specifying the bit precision of a value. |
static String |
WARNING_PARAMETER
|
Fields inherited from class PIRL.PVL.Parameter |
---|
AGGREGATE, ASSIGNMENT, BEGIN_GROUP, BEGIN_OBJECT, END, END_AGGREGATE, END_GROUP, END_OBJECT, END_PVL, GROUP, HIGHEST_BIT, LOWEST_BIT, MASK, OBJECT, TOKEN |
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
---|---|
JPEG2000_Info()
Construct a an empty JPEG2000_Info Object. |
|
JPEG2000_Info(File file)
Construct a JPEG2000_Info for a File. |
|
JPEG2000_Info(ImageInputStream image_input_stream)
Construct a JPEG2000_Info for an ImageInputStream. |
|
JPEG2000_Info(String source)
Construct a JPEG2000_Info for a named source. |
Method Summary | |
---|---|
protected void |
Data_Offset_Parameters(Parameter group,
long start_offset,
long end_offset)
Add data offset Parameters to a Parameter Group. |
protected void |
Data_Position_Parameters(Parameter group,
long end_position)
Add data position Parameters to a Parameter Group. |
static int[] |
int_Array(Parameter parameter)
Get the Array Value of a Parameter as an int array. |
int[] |
int_Array(String parameter_name)
Get the Array Value of a Parameter as an int array. |
static int[] |
int_Array(Value value)
Convert an Array Value to an int array. |
protected int |
Read_byte(String description)
Get the next byte data value from the Source. |
protected int |
Read_int(String description)
Get the next int data value from the Source. |
protected long |
Read_long(String description)
Get the next long data value from the Source. |
protected int |
Read_short(String description)
Get the next short data value from the Source. |
protected String |
Read_String(String description,
long end_position)
Get a String from the Source. |
protected int |
Read_Unsigned_byte(String description)
Get the next byte data value from the Source as an unsigned integer. |
protected long |
Read_Unsigned_int(String description)
Get the next int data value from the Source as an unsigned integer. |
protected int |
Read_Unsigned_short(String description)
Get the next short data value from the Source as an unsigned integer. |
protected long |
Read_Value(String description,
int bits)
Get a value of some bits precision from the Source. |
boolean |
Skip_Tiles()
Test if tile segments will be skipped. |
JPEG2000_Info |
Skip_Tiles(boolean enabled)
Enable of disable skipping of tile segments. |
ImageInputStream |
Source()
Get the currently assigned ImageInputStream information source. |
JPEG2000_Info |
Source(File file)
Assign a File as the information source. |
JPEG2000_Info |
Source(ImageInputStream image_input_stream)
Assign an ImageInputStream as the information source. |
JPEG2000_Info |
Source(String source)
Assign a named file as the information source. |
long |
Stream_Position()
Get the current source stream position. |
protected void |
Stream_Position(long position)
Set the stream position of the information Source. |
boolean |
Throw_Illegal_State()
Test if IllegalStateException will be thrown when an invalid JP2 box or codestream segment structure or contents is encountered. |
JPEG2000_Info |
Throw_Illegal_State(boolean enabled)
Enable or disable throwing of IllegalStateException when an invalid JP2 box or codestream segment structure or contents is encountered. |
boolean |
Use_Data_Position()
Test if Source data position parameters will be used. |
JPEG2000_Info |
Use_Data_Position(boolean enabled)
Enable or disable the use of Source data position parameters. |
protected Parameter |
Value_Bits_Parameter(String description,
long end_position)
Generate a VALUE_BITS_PARAMETER from the source. |
protected static Parameter |
Value_Bits_Parameter(Value array)
Generate a VALUE_BITS_PARAMETER from an Array of raw Values. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String DATA_POSITION_PARAMETER
public static final String DATA_OFFSET_PARAMETER
For JP2 boxes, the offset is relative to the byte immediately following the box header's length, type and extended length (if present) fields.
For codestream segements, the offset is relative to the byte immediately following the segment marker and length fields.
public static final String DATA_LENGTH_PARAMETER
public static final String VALUE_BITS_PARAMETER
public static final int BITS_VARIABLE
public static final String LENGTH_PARAMETER
public static final String POSITION_PARAMETER
public static final String TOTAL_COMPONENTS_PARAMETER
public static final String WARNING_PARAMETER
public static final String UNKNOWN
protected ImageInputStream Image_Input_Stream
Source()
protected long Stream_Position
Stream_Position()
public static boolean Skip_Tiles_Default
Skip_Tiles(boolean)
protected boolean Skip_Tiles
Skip_Tiles(boolean)
public static boolean Use_Data_Position_Default
data position parameters
in preference to data offset
parameters
.
Use_Data_Position(boolean)
protected boolean Use_Data_Position
data
position parameters
in preference to data offset
parameters
.
Use_Data_Position(boolean)
public static boolean Throw_Illegal_State_Default
Throw_Illegal_State(boolean)
protected boolean Throw_Illegal_State
Throw_Illegal_State(boolean)
Constructor Detail |
---|
public JPEG2000_Info(String source) throws IOException, UnknownHostException, IllegalArgumentException
source
- The source from which to obtain the JPEG2000_Info.
This may be a local filename or a remote URL reference.
UnknownHostException
- If the source is a URL but the
hostname is specifies can not be resolved.
IllegalArgumentException
- If the source is a URL but does
not specify the http protocol or a source pathname.
IOException
- If there was a problem reading the file.public JPEG2000_Info(File file) throws IOException
file
- The File from which to obtain the JPEG2000_Info.
IOException
- If there was a problem reading the file.public JPEG2000_Info(ImageInputStream image_input_stream)
image_input_stream
- The ImageInputStream from which to obtain
the JPEG2000_Info.
IOException
- If there was a problem reading the file.public JPEG2000_Info()
Use one of the Source methods to assign a source file.
Method Detail |
---|
public JPEG2000_Info Source(String source) throws IOException, UnknownHostException, IllegalArgumentException
An attempt is made to form a URL from the source. If this succeeds an
HTTP_ImageInput_Stream is constructed from the URL and then delegated
to the Source(ImageInputStream)
method.
If a URL can not be formed from the source a File is constructed from
the source and then delegated to the Source(File)
method.
source
- The name of the source to use as the information source.
UnknownHostException
- If the source is a URL but the
hostname is specifies can not be resolved.
IllegalArgumentException
- If the source is a URL but does
not specify the http protocol or a source pathname.
FileNotFoundException
- If the file could not be accessed for
any reason.
ProtocolException
- If the source is a valid URL but an HTTP
Status
protocol error was
returned by the server.
IOException
- If there was a problem reading the source.public JPEG2000_Info Source(File file) throws IOException
The name of this JPEG2000_Info is set to the canonical pathname of the File.
An ImageInputStream is constructed from the file and then delegated
to the Source(ImageInputStream)
method.
file
- The File to use as the information source.
FileNotFoundException
- If the file could not be accessed for
any reason.
IOException
- If there was a problem reading the file.public JPEG2000_Info Source(ImageInputStream image_input_stream)
If the image_input_stream is null or identical to the currently assigned ImageInputStream nothing is done.
If this JPEG2000_Info does not have a name it is set to
"ImageInputStream". All Parameters are removed. The current stream position
is determined.
image_input_stream
- The ImageInputStream to use as the
information source.
public ImageInputStream Source()
public JPEG2000_Info Skip_Tiles(boolean enabled)
When a codestream is being scanned for segment markers the tile-part segments - which begin with a Start-Of_Tile (SOT) marker - may be skipped. When there are many tiles in the codestream this will significantly reduce the amount of time to scan the Source and the number of Parameter groups generated.
enabled
- If true, tile-part segments will be skipped; otherwise
all tile-part segments will be examined and Parameter groups
assembled for each one.
public boolean Skip_Tiles()
Skip_Tiles(boolean)
public JPEG2000_Info Use_Data_Position(boolean enabled)
enabled
- If true, Source data position parameters are included
for all JP2 boxes and codestream segments, and used elsewhere.
Otherwise position parameters are not included and data offset
parameters are used elsewhere instead of position parameters.
public boolean Use_Data_Position()
Use_Data_Position(boolean)
public JPEG2000_Info Throw_Illegal_State(boolean enabled)
enabled
- If true an IllegalStateException will be thrown at
the point where the JP2 box or codestream segment structure is
determined to be invalid.
public boolean Throw_Illegal_State()
Throw_Illegal_State(boolean)
protected long Read_long(String description) throws IOException
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected int Read_int(String description) throws IOException
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected long Read_Unsigned_int(String description) throws IOException
The next int value read from the Source
is
cast as a long value but without sign extension.
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected int Read_short(String description) throws IOException
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected int Read_Unsigned_short(String description) throws IOException
The next short value read from the Source
is
cast as an int value but without sign extension.
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected int Read_byte(String description) throws IOException
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected int Read_Unsigned_byte(String description) throws IOException
The current stream position
is updated.
description
- A String describing the value being obtained.
IOException
- If there was a problem reading from the Source.protected long Read_Value(String description, int bits) throws IOException
If the number of bits is negative the most significant bit of the
value is treated as a sign bit (extended in the returned value) and
the actual precision of the value is abs (bits). The Source stream is
read starting at the current stream
position
. Bytes are read from the stream starting with the most
significant byte of the value with the most significant bits right
justified in this first byte; the least significant bit is presumed
to be the least significant bit of the last byte read. The bytes read
are concatenated to form the value that is returned.
The current stream position
is updated.
description
- A String describing the value being obtained.bits
- The precision of the value is abs (bits). Negative
bits means the value is signed; i.e. the most significant bit is
the sign bit.
IOException
- If there was a problem reading the value bytes from
the Source stream.
ArithmeticException
- If abs (bits) > 64.protected String Read_String(String description, long end_position) throws IOException
Starting at the current stream position
bytes are read up to, but not including, the end position. Each byte
read is concatenated as a character in the resultant String with
unprintable characters being expanded into printable escape
sequences. However, if the last character is null it is not
included in the String.
The current stream position
is updated.
description
- A String describing the value being obtained.end_position
- The end position in the Source after the
last byte to be read.
IOException
- If there was a problem reading from the Source.protected void Stream_Position(long position) throws IOException
If the specified position is the same as the current position of the Source, nothing is done. Otherwise the current position of the Source is changed to the specified position.
position
- The position, as a byte offset from the beginning
of the file, to which to reposition the image Source stream. This
value must be a non-negative value less than the size of the
Source file, otherwise an IOException will be thrown.
IOException
- If the Source stream could not be repositioned. An
attempt will be made to reset the Source stream to return it to the
last marked position before the exception is thrown.public long Stream_Position()
protected void Data_Position_Parameters(Parameter group, long end_position) throws IllegalArgumentException
A DATA_POSITION_PARAMETER
is added to the group with the
current stream position
as its value. A
DATA_LENGTH_PARAMETER
is also added to the group with the
number of bytes between the current stream position (inclusive) and
the end position (exclusive) as its value.
N.B.: If using data
position parameters
is disabled data offset
parameters
will be used instead for the same values.
group
- The Parameter Group (Aggregate) to receive the data
location parameters.end_position
- The end position in the Source of the data as
a byte offset from the beginning of the file to the byte
immediately following the last byte of the data segement. If this
value is not greater than zero no DATA_LENGTH_PARAMETER
is included.
IllegalArgumentException
- If the current stream position
is greater than the data end
position.Data_Offset_Parameters(Parameter, long, long)
protected void Data_Offset_Parameters(Parameter group, long start_offset, long end_offset) throws IllegalArgumentException
A DATA_OFFSET_PARAMETER
is added to the group followed by a
a DATA_LENGTH_PARAMETER
.
group
- The Parameter Group (Aggregate) to receive the data
offset parameters.start_offset
- The offset (in bytes relative to 0) of the
data location - excluding segment marker and length elements - in
the enclosing object.end_offset
- The offset of the end (byte immediately following
the last data byte) of the data block. If this value is not greater
than zero no DATA_LENGTH_PARAMETER
is included.
IllegalArgumentException
- If the data start offser is
greater than the end offset. #Stream_Position() stream position}
is greater than the data end position.Data_Position_Parameters(Parameter, long)
protected Parameter Value_Bits_Parameter(String description, long end_position) throws IOException
VALUE_BITS_PARAMETER
from the source.
Signed byte values are read from the Source starting at the current
stream position
up to, but not including,
the end position. The value is incremented by 1. If the byte value
read is negative only the least significant 7 bits are valid; the
resultant value is the negative of the value of these bits. A
negative value signals that the values whose bit precision is the
absolute of the value is a signed value. A value of zero signals that
the actual precision values are indictated elsewhere.
Each value read is added to an Array Value that is assigned to a
Parameter named VALUE_BITS_PARAMETER
which is what is
returned.
description
- A String describing the values being obtained.end_position
- The end position in the Source of the values
as a byte offset from the beginning of the file to the byte
immediately following the last byte to be read.
VALUE_BITS_PARAMETER
that has an Array Value with the adjust values read from the Source.
IOException
- If there was a problem reading from the Source.protected static Parameter Value_Bits_Parameter(Value array)
VALUE_BITS_PARAMETER
from an Array of raw Values.
The datum of each Value in the array is assumed to be a raw bit precision value. This value is incremented by 1. If the value is negative the least significant 7 bits are taken and then negated to signal that the image values are signed. The image value precision of each component is the absolute value of the corresponding entry in the array.
The resultant Array is assigned to a Parameter named VALUE_BITS_PARAMETER
which is what is returned.
array
- A Array Value containing raw bit precision values.
VALUE_BITS_PARAMETER
that has a Value that is an Array of the adjusted array values.public int[] int_Array(String parameter_name)
parameter_name
- The name of the parameter to use. The first
Parameter found with this name, which may be a pathname, is used.
int_Array(Parameter)
public static int[] int_Array(Parameter parameter)
parameter
- The Parameter from which to obtain Array Values.
int_Array(Value)
public static int[] int_Array(Value value)
Each Integer Value in the Array Value is used to set the respective value of an int array. Any Value in the Array that is not an Integer is ignored; Sub-Array Values are not entered.
value
- The Array Value to convert.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |