int readWMO ( ucar . unidata . io . RandomAccessFile raf ) throws IOException { int pos = 0 ; //long actualSize = 0; raf . seek ( pos ) ; int readLen = 35 ; // Read in the contents of the NEXRAD Level III product head byte [ ] b = new byte [ readLen ] ; int rc = raf . read ( b ) ; if ( rc != readLen ) { // out.println(" error reading nids product header"); return 0 ; } // new check int iarr2_1 = bytesToInt ( b [ 0 ] , b [ 1 ] , false ) ; int iarr2_16 = bytesToInt ( b [ 30 ] , b [ 31 ] , false ) ; int iarr2_10 = bytesToInt ( b [ 18 ] , b [ 19 ] , false ) ; int iarr2_7 = bytesToInt ( b [ 12 ] , b [ 13 ] , false ) ; if ( ( iarr2_1 == iarr2_16 ) && ( ( iarr2_1 >= 16 ) && ( iarr2_1 <= 299 ) ) && ( iarr2_10 == - 1 ) && ( iarr2_7 < 10000 ) ) { noHeader = true ; return 1 ; } //Get product message header into a string for processing String pib = new String ( b , CDM . utf8Charset ) ; if ( pib . indexOf ( "SDUS" ) != - 1 ) { noHeader = false ; return 1 ; } else if ( raf . getLocation ( ) . indexOf ( ".nids" ) != - 1 ) { noHeader = true ; return 1 ; // } else if(checkMsgHeader(raf) == 1) { // noHeader = true; // return 1; } else return 0 ; }
read the header of input file and parsing the WMO part