static private boolean checkfpx(InputStream is) throws IOException {
  is.mark(0x100);
  long toSkip=(long)0x1C;
  long posn;
  if ((posn=skipForward(is,toSkip)) < toSkip) {
    is.reset();
    return false;
  }
  int c[]=new int[16];
  if (readBytes(c,2,is) < 0) {
    is.reset();
    return false;
  }
  int byteOrder=c[0];
  posn+=2;
  int uSectorShift;
  if (readBytes(c,2,is) < 0) {
    is.reset();
    return false;
  }
  if (byteOrder == 0xFE) {
    uSectorShift=c[0];
    uSectorShift+=c[1] << 8;
  }
 else {
    uSectorShift=c[0] << 8;
    uSectorShift+=c[1];
  }
  posn+=2;
  toSkip=(long)0x30 - posn;
  long skipped=0;
  if ((skipped=skipForward(is,toSkip)) < toSkip) {
    is.reset();
    return false;
  }
  posn+=skipped;
  if (readBytes(c,4,is) < 0) {
    is.reset();
    return false;
  }
  int sectDirStart;
  if (byteOrder == 0xFE) {
    sectDirStart=c[0];
    sectDirStart+=c[1] << 8;
    sectDirStart+=c[2] << 16;
    sectDirStart+=c[3] << 24;
  }
 else {
    sectDirStart=c[0] << 24;
    sectDirStart+=c[1] << 16;
    sectDirStart+=c[2] << 8;
    sectDirStart+=c[3];
  }
  posn+=4;
  is.reset();
  toSkip=0x200L + (long)(1 << uSectorShift) * sectDirStart + 0x50L;
  if (toSkip < 0) {
    return false;
  }
  is.mark((int)toSkip + 0x30);
  if ((skipForward(is,toSkip)) < toSkip) {
    is.reset();
    return false;
  }
  if (readBytes(c,16,is) < 0) {
    is.reset();
    return false;
  }
  if (byteOrder == 0xFE && c[0] == 0x00 && c[2] == 0x61 && c[3] == 0x56 && c[4] == 0x54 && c[5] == 0xC1 && c[6] == 0xCE && c[7] == 0x11 && c[8] == 0x85 && c[9] == 0x53 && c[10] == 0x00 && c[11] == 0xAA && c[12] == 0x00 && c[13] == 0xA1 && c[14] == 0xF9 && c[15] == 0x5B) {
    is.reset();
    return true;
  }
 else   if (c[3] == 0x00 && c[1] == 0x61 && c[0] == 0x56 && c[5] == 0x54 && c[4] == 0xC1 && c[7] == 0xCE && c[6] == 0x11 && c[8] == 0x85 && c[9] == 0x53 && c[10] == 0x00 && c[11] == 0xAA && c[12] == 0x00 && c[13] == 0xA1 && c[14] == 0xF9 && c[15] == 0x5B) {
    is.reset();
    return true;
  }
  is.reset();
  return false;
}

static private boolean checkfpx ( InputStream is ) throws IOException { is . mark ( 0x100 ) ; long toSkip = ( long ) 0x1C ; long posn ; if ( ( posn = skipForward ( is , toSkip ) ) < toSkip ) { is . reset ( ) ; return false ; } int c [ ] = new int [ 16 ] ; if ( readBytes ( c , 2 , is ) < 0 ) { is . reset ( ) ; return false ; } int byteOrder = c [ 0 ] ; posn += 2 ; int uSectorShift ; if ( readBytes ( c , 2 , is ) < 0 ) { is . reset ( ) ; return false ; } if ( byteOrder == 0xFE ) { uSectorShift = c [ 0 ] ; uSectorShift += c [ 1 ] << 8 ; } else { uSectorShift = c [ 0 ] << 8 ; uSectorShift += c [ 1 ] ; } posn += 2 ; toSkip = ( long ) 0x30 - posn ; long skipped = 0 ; if ( ( skipped = skipForward ( is , toSkip ) ) < toSkip ) { is . reset ( ) ; return false ; } posn += skipped ; if ( readBytes ( c , 4 , is ) < 0 ) { is . reset ( ) ; return false ; } int sectDirStart ; if ( byteOrder == 0xFE ) { sectDirStart = c [ 0 ] ; sectDirStart += c [ 1 ] << 8 ; sectDirStart += c [ 2 ] << 16 ; sectDirStart += c [ 3 ] << 24 ; } else { sectDirStart = c [ 0 ] << 24 ; sectDirStart += c [ 1 ] << 16 ; sectDirStart += c [ 2 ] << 8 ; sectDirStart += c [ 3 ] ; } posn += 4 ; is . reset ( ) ; toSkip = 0x200L + ( long ) ( 1 << uSectorShift ) * sectDirStart + 0x50L ; if ( toSkip < 0 ) { return false ; } is . mark ( ( int ) toSkip + 0x30 ) ; if ( ( skipForward ( is , toSkip ) ) < toSkip ) { is . reset ( ) ; return false ; } if ( readBytes ( c , 16 , is ) < 0 ) { is . reset ( ) ; return false ; } if ( byteOrder == 0xFE && c [ 0 ] == 0x00 && c [ 2 ] == 0x61 && c [ 3 ] == 0x56 && c [ 4 ] == 0x54 && c [ 5 ] == 0xC1 && c [ 6 ] == 0xCE && c [ 7 ] == 0x11 && c [ 8 ] == 0x85 && c [ 9 ] == 0x53 && c [ 10 ] == 0x00 && c [ 11 ] == 0xAA && c [ 12 ] == 0x00 && c [ 13 ] == 0xA1 && c [ 14 ] == 0xF9 && c [ 15 ] == 0x5B ) { is . reset ( ) ; return true ; } else if ( c [ 3 ] == 0x00 && c [ 1 ] == 0x61 && c [ 0 ] == 0x56 && c [ 5 ] == 0x54 && c [ 4 ] == 0xC1 && c [ 7 ] == 0xCE && c [ 6 ] == 0x11 && c [ 8 ] == 0x85 && c [ 9 ] == 0x53 && c [ 10 ] == 0x00 && c [ 11 ] == 0xAA && c [ 12 ] == 0x00 && c [ 13 ] == 0xA1 && c [ 14 ] == 0xF9 && c [ 15 ] == 0x5B ) { is . reset ( ) ; return true ; } is . reset ( ) ; return false ; }
check for flashpix image data in inputstream is . return true if the stream has flashpix data , false otherwise . before calling this method , the stream should have already been checked to be sure it contains microsoft structured storage data .
