private String readHeaderString ( BufferedInputStream stream ) throws IOException { int bufferSize = 100 ; stream . mark ( bufferSize ) ; byte [ ] buffer = new byte [ bufferSize ] ; stream . read ( buffer ) ; Charset charset = CharsetHelper . UTF8 ; String header = new String ( buffer , charset ) ; int prefixIndex = header . indexOf ( "PPX!!!!|" ) ; int suffixIndex = header . indexOf ( "|!!!!XPP" ) ; if ( prefixIndex != 0 || suffixIndex == - 1 ) { throw new IOException ( "File format not recognised" ) ; } int skip = suffixIndex + 9 ; stream . reset ( ) ; stream . skip ( skip ) ; return header . substring ( prefixIndex + 8 , suffixIndex ) ; }
Read the header from the Phoenix file .