static public void dumpbytes ( ByteBuffer buf0 , boolean skipdmr ) { int savepos = buf0 . position ( ) ; int limit0 = buf0 . limit ( ) ; int skipcount = 0 ; if ( limit0 > MAXLIMIT ) limit0 = MAXLIMIT ; if ( limit0 >= buf0 . limit ( ) ) limit0 = buf0 . limit ( ) ; if ( skipdmr ) { ByteOrder saveorder = buf0 . order ( ) ; buf0 . order ( ByteOrder . BIG_ENDIAN ) ; // must read in network order skipcount = buf0 . getInt ( ) ; //dmr count buf0 . order ( saveorder ) ; skipcount &= 0xFFFFFF ; // mask off the flags to get true count skipcount += 4 ; // skip the count also } byte [ ] bytes = new byte [ ( limit0 + 8 ) - skipcount ] ; Arrays . fill ( bytes , ( byte ) 0 ) ; buf0 . position ( savepos + skipcount ) ; buf0 . get ( bytes , 0 , limit0 - skipcount ) ; buf0 . position ( savepos ) ; System . err . println ( "order=" + buf0 . order ( ) ) ; ByteBuffer buf = ByteBuffer . wrap ( bytes ) . order ( buf0 . order ( ) ) ; dumpbytes ( buf ) ; }
Provide a simple dump of binary data