Examples of SnappyOutputStream


Examples of org.xerial.snappy.SnappyOutputStream

                    out.flush();
                    logger.trace("Upgrading OutputStream to be compressed");
                    if (targetVersion < MessagingService.VERSION_21)
                    {
                        // Snappy is buffered, so no need for extra buffering output stream
                        out = new DataOutputStreamPlus(new SnappyOutputStream(socket.getOutputStream()));
                    }
                    else
                    {
                        // TODO: custom LZ4 OS that supports BB write methods
                        LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

    BSPMessageCompressor<M> {

  @Override
  public byte[] compress(byte[] bytes) {
    ByteArrayOutputStream bos = null;
    SnappyOutputStream sos = null;
    DataOutputStream dos = null;
    byte[] compressedBytes = null;

    try {
      bos = new ByteArrayOutputStream();
      sos = new SnappyOutputStream(bos);
      dos = new DataOutputStream(sos);

      dos.write(bytes);
      dos.close(); // Flush the stream as no more data will be sent.

      compressedBytes = bos.toByteArray();

    } catch (IOException ioe) {
      LOG.error("Unable to compress", ioe);
    } finally {
      try {
        sos.close();
        bos.close();
      } catch (IOException e) {
        LOG.warn("Failed to close compression streams.", e);
      }
    }
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

                {
                    out.flush();
                    logger.trace("Upgrading OutputStream to be compressed");
                    if (targetVersion < MessagingService.VERSION_21)
                    {
                        out = new DataOutputStream(new SnappyOutputStream(new BufferedOutputStream(socket.getOutputStream())));
                    }
                    else
                    {
                        LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
                        Checksum checksum = XXHashFactory.fastestInstance().newStreamingHash32(LZ4_HASH_SEED).asChecksum();
View Full Code Here

Examples of org.xerial.snappy.SnappyOutputStream

  @Override
  public BSPCompressedBundle compressBundle(BSPMessageBundle<M> bundle) {
    BSPCompressedBundle compMsgBundle = null;
    ByteArrayOutputStream bos = null;
    SnappyOutputStream sos = null;
    DataOutputStream dos = null;

    try {
      bos = new ByteArrayOutputStream();
      sos = new SnappyOutputStream(bos);
      dos = new DataOutputStream(sos);

      bundle.write(dos);
      dos.close(); // Flush the stream as no more data will be sent.

      byte[] data = bos.toByteArray();
      compMsgBundle = new BSPCompressedBundle(data);

    } catch (IOException ioe) {
      LOG.error("Unable to compress", ioe);
    } finally {
      try {
        sos.close();
        bos.close();
      } catch (IOException e) {
        LOG.warn("Failed to close compression streams.", e);
      }
    }
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

Examples of org.xerial.snappy.SnappyOutputStream

                    CompactEndpointSerializationHelper.serialize(FBUtilities.getBroadcastAddress(), out);
                    if (shouldCompressConnection())
                    {
                        out.flush();
                        logger.debug("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.