public void nextEntry(ZipEntry ze) throws IOException {
  LOG.fine("nextEntry().currentPos=" + currentPos);
  byte[] intBuffer=new byte[4];
  int bytesRead=fis.read(intBuffer);
  LOG.fine("bytes read=" + bytesRead);
  if (bytesRead == -1) {
    throw new IOException("no data available - available=" + fis.available());
  }
  int dataDescriptorLength=0;
  if (Arrays.equals(intBuffer,new byte[]{0x50,0x4b,0x07,0x08})) {
    dataDescriptorLength=4 + 4 + 4;
    fis.skip(dataDescriptorLength);
    fis.read(intBuffer);
  }
  if (!Arrays.equals(intBuffer,new byte[]{0x50,0x4b,0x03,0x04})) {
    throw new IOException("wrong local file header signature - value=" + ByteArrayHelper.toString(intBuffer));
  }
  boolean hasDataDescriptor=(ze.getMethod() & 8) > 0;
  LOG.fine("nextEntry().hasDataDescriptor=" + hasDataDescriptor);
  this.compressedSize=ze.getCompressedSize();
  fis.skip(14 + 4 + 4);
  byte[] shortBuffer=new byte[2];
  fis.read(shortBuffer);
  int fileNameLength=ByteArrayHelper.toInt(shortBuffer);
  fis.read(shortBuffer);
  int extraFieldLength=ByteArrayHelper.toInt(shortBuffer);
  startPos=18 + 12 + fileNameLength+ extraFieldLength+ dataDescriptorLength;
  currentPos=startPos;
  endPos=startPos + this.compressedSize;
  fis.skip(fileNameLength + extraFieldLength);
}

public void nextEntry ( ZipEntry ze ) throws IOException { LOG . fine ( "nextEntry().currentPos=" + currentPos ) ; byte [ ] intBuffer = new byte [ 4 ] ; int bytesRead = fis . read ( intBuffer ) ; LOG . fine ( "bytes read=" + bytesRead ) ; if ( bytesRead == - 1 ) { throw new IOException ( "no data available - available=" + fis . available ( ) ) ; } int dataDescriptorLength = 0 ; if ( Arrays . equals ( intBuffer , new byte [ ] { 0x50 , 0x4b , 0x07 , 0x08 } ) ) { dataDescriptorLength = 4 + 4 + 4 ; fis . skip ( dataDescriptorLength ) ; fis . read ( intBuffer ) ; } if ( ! Arrays . equals ( intBuffer , new byte [ ] { 0x50 , 0x4b , 0x03 , 0x04 } ) ) { throw new IOException ( "wrong local file header signature - value=" + ByteArrayHelper . toString ( intBuffer ) ) ; } boolean hasDataDescriptor = ( ze . getMethod ( ) & 8 ) > 0 ; LOG . fine ( "nextEntry().hasDataDescriptor=" + hasDataDescriptor ) ; this . compressedSize = ze . getCompressedSize ( ) ; fis . skip ( 14 + 4 + 4 ) ; byte [ ] shortBuffer = new byte [ 2 ] ; fis . read ( shortBuffer ) ; int fileNameLength = ByteArrayHelper . toInt ( shortBuffer ) ; fis . read ( shortBuffer ) ; int extraFieldLength = ByteArrayHelper . toInt ( shortBuffer ) ; startPos = 18 + 12 + fileNameLength + extraFieldLength + dataDescriptorLength ; currentPos = startPos ; endPos = startPos + this . compressedSize ; fis . skip ( fileNameLength + extraFieldLength ) ; }
position input stream to start of zipentry this instance was created for
