/**
   * Flushes this output stream, forcing any pending buffered output bytes to be written.
   *
   * @throws IOException if an I/O error occurs or this stream is already closed
   */
  public void flush() throws IOException {
    ensureOpen();

    // Finish decompressing and writing pending output data
    if (!inf.finished()) {
      try {
        while (!inf.finished() && !inf.needsInput()) {
          int n;

          // Decompress pending output data
          n = inf.inflate(buf, 0, buf.length);
          if (n < 1) {
            break;
          }

          // Write the uncompressed output data block
          out.write(buf, 0, n);
        }
        super.flush();
      } catch (DataFormatException ex) {
        // Improperly formatted compressed (ZIP) data
        String msg = ex.getMessage();
        if (msg == null) {
          msg = "Invalid ZLIB data format";
        }
        throw new ZipException(msg);
      }
    }
  }
  public void close() throws IOException {
    for (int i = 1; i < databuffer.length; i++) {
      super.write(databuffer[i]);
    }

    super.flush();
    super.close();
  }
예제 #3
0
 /**
  * Flushes this output stream by forcing any buffered output bytes that have already been
  * processed by the encapsulated cipher object to be written out.
  *
  * <p>Any bytes buffered by the encapsulated cipher and waiting to be processed by it will not be
  * written out. For example, if the encapsulated cipher is a block cipher, and the total number of
  * bytes written using one of the <code>write</code> methods is less than the cipher's block size,
  * no bytes will be written out.
  *
  * @exception java.io.IOException if an I/O error occurs.
  */
 public void flush() throws IOException {
   super.flush();
 }
예제 #4
0
 @Override
 public void flush() throws IOException {
   super.flush();
   out2.flush();
 }
예제 #5
0
 @Override
 public void close() throws IOException {
   if (this.blockPos > 0) this.writeInfo();
   super.flush();
   super.close();
 }