Examples of SnappyOutputStream


Examples of org.iq80.snappy.SnappyOutputStream

    public String getType() {
        return "snappy";
    }

    protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
        return new SnappyOutputStream(underlying);
    }
View Full Code Here

Examples of org.iq80.snappy.SnappyOutputStream

        return byteArrayOutputStream.toByteArray();
    }

    public static void compress(byte[] in, OutputStream out) throws IOException {
        SnappyOutputStream snappyOutputStream = new SnappyOutputStream(out);
        snappyOutputStream.write(in);
        snappyOutputStream.close();
    }
View Full Code Here

Examples of org.iq80.snappy.SnappyOutputStream

        byte[] origBytes = messagePack.write(object);
        System.out.println("orig length: " + origBytes.length);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        SnappyOutputStream snappyOutputStream = new SnappyOutputStream(out);
        snappyOutputStream.write(origBytes);
        snappyOutputStream.close();

        byte[] comressedBytes = out.toByteArray();
        System.out.println("comressedBytes length: " + comressedBytes.length);

        byte[] bytes = cipherEncrypt.get().doFinal(comressedBytes);
View Full Code Here

Examples of org.iq80.snappy.SnappyOutputStream

    /**
     * {@inheritDoc}
     */
    @Override
    protected OutputStream wrapCompressInternal(OutputStream out) throws IOException {
        return new SnappyOutputStream(out);
    }
View Full Code Here

Examples of org.iq80.snappy.SnappyOutputStream

//    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      SnappyOutputStream snappyOutputStream = new SnappyOutputStream(baos);
      snappyOutputStream.write(uncompressedBytes);
      snappyOutputStream.close();
      baos.close();
    } catch (IOException e) {
      // This should not happen
      logger.error("Could not compress sensei request ", e);
    }
View Full Code Here

Examples of org.iq80.snappy.SnappyOutputStream

//    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      SnappyOutputStream snappyOutputStream = new SnappyOutputStream(baos);
      snappyOutputStream.write(uncompressedBytes);
      snappyOutputStream.close();
      baos.close();
    } catch (IOException e) {
      // This should not happen
      logger.error("Could not compress sensei request ", e);
    }
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

      "Compressed file: " + compressed.toString() + " unexpectedly " +
        "exists.");

    BufferedInputStream in = null;
    FileOutputStream out = null;
    SnappyOutputStream snappyOut = null;
    try {
      in = new BufferedInputStream(new FileInputStream(uncompressed));
      out = new FileOutputStream(compressed);
      snappyOut = new SnappyOutputStream(out);

      byte[] buf = new byte[FILE_BUFFER_SIZE];
      while(true) {
        int read = in.read(buf);
        if (read == -1) {
          break;
        }
        snappyOut.write(buf, 0, read);
      }
      out.getFD().sync();
      return true;
    } catch (Exception ex) {
      LOG.error("Error while attempting to compress " +
        uncompressed.toString() + " to " + compressed.toString()
        + ".", ex);
      Throwables.propagate(ex);
    } finally {
      Throwable th = null;
      try {
        if (in != null) {
          in.close();
        }
      } catch (Throwable ex) {
        LOG.error("Error while closing input file.", ex);
        th = ex;
      }
      try {
        if (snappyOut != null) {
          snappyOut.close();
        }
      } catch (IOException ex) {
        LOG.error("Error while closing output file.", ex);
        Throwables.propagate(ex);
      }
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

                    CompactEndpointSerializationHelper.serialize(FBUtilities.getBroadcastAddress(), out);
                    if (shouldCompressConnection())
                    {
                        out.flush();
                        logger.trace("Upgrading OutputStream to be compressed");
                        out = new DataOutputStream(new SnappyOutputStream(new BufferedOutputStream(socket.getOutputStream())));
                    }
                }

                return true;
            }
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

                    CompactEndpointSerializationHelper.serialize(FBUtilities.getBroadcastAddress(), out);
                    if (shouldCompressConnection())
                    {
                        out.flush();
                        logger.trace("Upgrading OutputStream to be compressed");
                        out = new DataOutputStream(new SnappyOutputStream(new BufferedOutputStream(socket.getOutputStream())));
                    }
                }

                return true;
            }
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

                    CompactEndpointSerializationHelper.serialize(FBUtilities.getBroadcastAddress(), out);
                    if (shouldCompressConnection())
                    {
                        out.flush();
                        logger.trace("Upgrading OutputStream to be compressed");
                        out = new DataOutputStream(new SnappyOutputStream(new BufferedOutputStream(socket.getOutputStream())));
                    }
                }

                return true;
            }
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.