it.geosolutions.imageio.plugins.nitronitf
Class NITFUtilities

java.lang.Object
  extended by it.geosolutions.imageio.plugins.nitronitf.NITFUtilities

public class NITFUtilities
extends Object

Utility class storing default values and constants, as well as a set of methods to do fields setting, field validation and compression parameters management.

Author:
Daniele Romagnoli, GeoSolutions SaS

Nested Class Summary
static class NITFUtilities.Consts
          Constants
static class NITFUtilities.WriteCompression
           
 
Constructor Summary
NITFUtilities()
           
 
Method Summary
static JP2KKakaduImageWriteParam getCompressionParam(JP2KKakaduImageWriter kakaduWriter, NITFUtilities.WriteCompression compression, boolean isMulti)
          Setup a proper set of JP2K writing parameters depending on the type of requested compression.
static boolean isNITFAvailable()
          Returns true if the NITF native library has been loaded.
static void loadNITF()
          Forces loading of NITF libs.
static void setField(String fieldName, nitf.Field field, byte[] fieldValue)
          Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.
static void setField(String fieldName, nitf.Field field, byte[] fieldValue, boolean doValidation)
          Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.
static void setField(String fieldName, nitf.Field field, String fieldValue)
          Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.
static void setField(String fieldName, nitf.Field field, String fieldValue, boolean doValidation)
          Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.
static void setTREField(nitf.TRE tre, String fieldName, String fieldValue, boolean doValidation)
          Set a field in the specified TRE
static void setTREFieldDirect(nitf.TRE tre, String fieldName, String fieldValue)
          Set a field in the specified TRE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NITFUtilities

public NITFUtilities()
Method Detail

isNITFAvailable

public static boolean isNITFAvailable()
Returns true if the NITF native library has been loaded. false otherwise.

Returns:
true only if the NITF native library has been loaded.

loadNITF

public static void loadNITF()
Forces loading of NITF libs.


getCompressionParam

public static JP2KKakaduImageWriteParam getCompressionParam(JP2KKakaduImageWriter kakaduWriter,
                                                            NITFUtilities.WriteCompression compression,
                                                            boolean isMulti)
Setup a proper set of JP2K writing parameters depending on the type of requested compression.

Parameters:
kakaduWriter - a writer instance to get default write parameters.
compression - the type of NITFUtilities.WriteCompression desired
isMulti - whether the image to be compressed is multi band or pancromatic.
Returns:
a JP2KKakaduImageWriteParam instance with proper writing parameters.

setTREField

public static void setTREField(nitf.TRE tre,
                               String fieldName,
                               String fieldValue,
                               boolean doValidation)
                        throws nitf.NITFException
Set a field in the specified TRE

Parameters:
tre - the TRE to be set
fieldName - the name of the field to be set
fieldValue - the value to be set for that field
doValidation - true to check if the provided value is compliant with the field properties (length and type).
Throws:
nitf.NITFException

setTREFieldDirect

public static void setTREFieldDirect(nitf.TRE tre,
                                     String fieldName,
                                     String fieldValue)
                              throws nitf.NITFException
Set a field in the specified TRE

Parameters:
tre - the TRE to be set
fieldName - the name of the field to be set
fieldValue - the value to be set for that field
Throws:
nitf.NITFException
See Also:
#setTREField(TRE, String, String, boolean)}

setField

public static void setField(String fieldName,
                            nitf.Field field,
                            String fieldValue)
Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.

Parameters:
fieldName - the name to be shown in case some exception occurs
field - the field to be set
fieldValue - the value, as a String, to be assigned to that field

setField

public static void setField(String fieldName,
                            nitf.Field field,
                            byte[] fieldValue)
Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes.

Parameters:
fieldName - the name to be shown in case some exception occurs
field - the field to be set
fieldValue - the value, as a byte[], to be assigned to that field

setField

public static void setField(String fieldName,
                            nitf.Field field,
                            String fieldValue,
                            boolean doValidation)
Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes. Validation of the provided value is performed depending on the values of the doValidation param.

Parameters:
fieldName - the name to be shown in case some exception occurs
field - the field to be set
fieldValue - the value, as a String, to be assigned to that field
doValidation - if true check the fieldValue is compliant with the field properties

setField

public static void setField(String fieldName,
                            nitf.Field field,
                            byte[] fieldValue,
                            boolean doValidation)
Set the specified fieldName, represented by the specified Field, with the provided fieldValue Note that the fieldName parameter is only used for logging/exceptions purposes. Validation of the provided value is performed depending on the values of the doValidation param.

Parameters:
fieldName - the name to be shown in case some exception occurs
field - the field to be set
fieldValue - the value, as a String, to be assigned to that field
doValidation - if true check the fieldValue is compliant with the field properties


Copyright © 2006–2013 GeoSolutions. All rights reserved.