Examples of GZIPOutputStream


Examples of java.util.zip.GZIPOutputStream

    private static Log logger = new Log("GZIP");
   
    public static void gzipFile(final String inFile, final String outFile) {
  try {
      final InputStream  fin  = new BufferedInputStream(new FileInputStream(inFile));
      final OutputStream fout = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(outFile), 1024));
      copy(fout, fin, 1024);
      fin.close();
      fout.close();
  } catch (final FileNotFoundException e) {
      logger.logWarning("ERROR: file '" + inFile + "' not found", e);
  } catch (final IOException e) {
            logger.logWarning("ERROR: IO trouble ",e);
  }
View Full Code Here

Examples of java.util.zip.GZIPOutputStream

    public static byte[] gzipString(final String in) {
  try {
      final InputStream  fin  = new ByteArrayInputStream(in.getBytes("UTF8"));
      final ByteArrayOutputStream baos = new ByteArrayOutputStream(in.length() / 3);
      final OutputStream fout = new GZIPOutputStream(baos, 128);
      copy(fout, fin, 1024);
      fin.close();
      fout.close();
      return baos.toByteArray();
  } catch (final IOException e) {
      logger.logWarning("ERROR: IO trouble ",e);
      return null;
  }
View Full Code Here

Examples of net.rim.device.api.compress.GZIPOutputStream

        return new CacheItem( storeKey, url, expires, data.length, pDataStore.size() );
    }

    private void writeDataToStore( ByteVectorWrapper dataVector, byte[] data ) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        GZIPOutputStream gzipStream = new GZIPOutputStream( baos, 6, GZIPOutputStream.MAX_LOG2_WINDOW_LENGTH );
        gzipStream.write( data );
        gzipStream.close();
        byte[] compressedData = baos.toByteArray();

        // Write compressed size
        int compressedSize = compressedData.length;
        int originalSize = data.length;
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.