List of usage examples for java.util.zip InflaterInputStream available
public int available() throws IOException
From source file:ZipUtil.java
private static void inflaterInputStmToFileOutputStm(InflaterInputStream stmIn, FileOutputStream stmOut) throws IOException { byte[] buffer = null; int iBufferSize = STREAM_BUFFER_SIZE; boolean bKeepStreaming = true; while (bKeepStreaming) { buffer = new byte[iBufferSize]; int iBytes = stmIn.read(buffer); if (iBytes == -1) { bKeepStreaming = false;/*from w ww.jav a 2 s . c o m*/ } else { if (iBytes < iBufferSize) { bKeepStreaming = false; byte[] tmp = new byte[iBytes]; for (int i = 0; i < iBytes; i++) { tmp[i] = buffer[i]; } buffer = tmp; } stmOut.write(buffer); //Override above test if available returns 1 if (stmIn.available() == 1) { bKeepStreaming = true; } } //end else some bytes returned. } //end while }