public int handleNITFHeader(BinaryFile binFile){
  try {
    byte[] nitfArray=binFile.readBytes(4,false);
    String nitf=new String(nitfArray);
    binFile.seek(RPF_DATE_LOCATION);
    nitfArray=binFile.readBytes(2,false);
    nitf=new String(nitfArray);
    if (nitf.equalsIgnoreCase("19") || nitf.equalsIgnoreCase("20"))     return 0;
    binFile.seek(RPF_DATE_LOCATION + TOC_NITF_HEADER_LENGTH);
    nitfArray=binFile.readBytes(2,false);
    nitf=new String(nitfArray);
    if (nitf.equalsIgnoreCase("19") || nitf.equalsIgnoreCase("20"))     return TOC_NITF_HEADER_LENGTH;
    binFile.seek(RPF_DATE_LOCATION + FRAME_SHORT_NITF_HEADER_LENGTH);
    nitfArray=binFile.readBytes(2,false);
    nitf=new String(nitfArray);
    if (nitf.equalsIgnoreCase("19") || nitf.equalsIgnoreCase("20"))     return FRAME_SHORT_NITF_HEADER_LENGTH;
    binFile.seek(RPF_DATE_LOCATION + FRAME_LONG_NITF_HEADER_LENGTH);
    nitfArray=binFile.readBytes(2,false);
    nitf=new String(nitfArray);
    if (nitf.equalsIgnoreCase("19") || nitf.equalsIgnoreCase("20"))     return FRAME_LONG_NITF_HEADER_LENGTH;
  }
 catch (  IOException e) {
    Debug.error("RpfHeader: File IO Error while handling NITF header:\n" + e);
    return -1;
  }
catch (  FormatException f) {
    Debug.error("RpfHeader: File IO Format error while reading header information:\n" + f);
    return -1;
  }
  return -1;
}

public int handleNITFHeader ( BinaryFile binFile ) { try { byte [ ] nitfArray = binFile . readBytes ( 4 , false ) ; String nitf = new String ( nitfArray ) ; binFile . seek ( RPF_DATE_LOCATION ) ; nitfArray = binFile . readBytes ( 2 , false ) ; nitf = new String ( nitfArray ) ; if ( nitf . equalsIgnoreCase ( "19" ) || nitf . equalsIgnoreCase ( "20" ) ) return 0 ; binFile . seek ( RPF_DATE_LOCATION + TOC_NITF_HEADER_LENGTH ) ; nitfArray = binFile . readBytes ( 2 , false ) ; nitf = new String ( nitfArray ) ; if ( nitf . equalsIgnoreCase ( "19" ) || nitf . equalsIgnoreCase ( "20" ) ) return TOC_NITF_HEADER_LENGTH ; binFile . seek ( RPF_DATE_LOCATION + FRAME_SHORT_NITF_HEADER_LENGTH ) ; nitfArray = binFile . readBytes ( 2 , false ) ; nitf = new String ( nitfArray ) ; if ( nitf . equalsIgnoreCase ( "19" ) || nitf . equalsIgnoreCase ( "20" ) ) return FRAME_SHORT_NITF_HEADER_LENGTH ; binFile . seek ( RPF_DATE_LOCATION + FRAME_LONG_NITF_HEADER_LENGTH ) ; nitfArray = binFile . readBytes ( 2 , false ) ; nitf = new String ( nitfArray ) ; if ( nitf . equalsIgnoreCase ( "19" ) || nitf . equalsIgnoreCase ( "20" ) ) return FRAME_LONG_NITF_HEADER_LENGTH ; } catch ( IOException e ) { Debug . error ( "RpfHeader: File IO Error while handling NITF header:\n" + e ) ; return - 1 ; } catch ( FormatException f ) { Debug . error ( "RpfHeader: File IO Format error while reading header information:\n" + f ) ; return - 1 ; } return - 1 ; }
checks to see if the file is in nitf or not , and then puts the file pointer in the right place to start reading the header for the file . if the file is in nitf format , it skips the nitf header , and if it isn ' t , it resets the pointer to the beginning .
