Package java.util.zip

Examples of java.util.zip.Deflater.end()


              dos.close();
            }
          }
          finally
          {
            def.end();
          }

          root.updateEntry(buildName, 0, nextEntry, bos.toByteArray());
        }
View Full Code Here


              dos.close();
            }
          }
          finally
          {
            def.end();
          }
          root.updateEntry(buildName, 0, nextEntry, bos.toByteArray());
        }

        zipIn.closeEntry();
View Full Code Here

            // try again, using the default strategy and compression level
            strategy = Deflater.DEFAULT_STRATEGY;
            level = Deflater.DEFAULT_COMPRESSION;
            return compress(in, inLen, out, outPos);
        }
        deflater.end();
        return outPos + compressed;
    }

    public int getAlgorithm() {
        return Compressor.DEFLATE;
View Full Code Here

            while (!compressor.finished()) {
                int count = compressor.deflate(buffer);
                out.write(buffer, 0, count);
            }
            out.close();
            compressor.end();
        }


        // don't do this if we got a HTTP 304 since there is no data to send back
        if (response.getStatus() != HttpServletResponse.SC_NOT_MODIFIED) {
View Full Code Here

      compressor.setInput(src);
      compressor.finish();
      int totalOut = compressor.deflate(compressed);
      byte[] zipsrc = new byte[totalOut];
      System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
      compressor.end();
      return codec.encode(zipsrc);
    } catch (Exception e) {
      throw new FacesException("Error encode resource data", e);
    }
  }
View Full Code Here

      return false;
    }
    finally
    {
      scrunch.finish();
      scrunch.end();
    }
  }

  /**
   * Write a PNG "IEND" chunk into the pngBytes array.
View Full Code Here

            if (secondContent.size() > 0) {
                secondContent.getInternalBuffer().writeTo(out);
            }
            out.close();
            if (deflater != null) {
                deflater.end();
            }
        }
        catch (Exception e) {
            throw new BadPdfFormatException(e.getMessage());
        }
View Full Code Here

    Deflater deflater =  new Deflater(Deflater.BEST_COMPRESSION, true);
    try (DeflaterOutputStream out = new DeflaterOutputStream(compressedBytes, deflater)) {
      // Use internal buffer to avoid copying it.
      out.write(bytes.getInternalBuffer(), 0, bytes.size());
    } finally {
      deflater.end();
    }
    return compressedBytes.toByteArray();
  }

  public static Object deserialize(byte[] bytes) throws IOException {
View Full Code Here

            if (secondContent.size() > 0) {
                secondContent.getInternalBuffer().writeTo(out);
            }
            out.close();
            if (deflater != null) {
                deflater.end();
            }
        }
        catch (Exception e) {
            throw new BadPdfFormatException(e.getMessage());
        }
View Full Code Here

                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                Deflater deflater = new Deflater(compressionLevel);
                DeflaterOutputStream zip = new DeflaterOutputStream(stream, deflater);
                zip.write(conts);
                zip.close();
                deflater.end();
                bytes = stream.toByteArray();
            }
            catch (IOException ioe) {
                throw new ExceptionConverter(ioe);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.