Package org.arch.buffer

Examples of org.arch.buffer.Buffer.readableBytes()


    byte[] raw = content.getRawBuffer();
    switch (type)
    {
      case NONE:
      {
        BufferHelper.writeVarInt(outbuf, content.readableBytes());
        outbuf.write(raw,content.getReadIndex(), content.readableBytes());
        break;
      }
      case QUICKLZ:
      {
View Full Code Here


    switch (type)
    {
      case NONE:
      {
        BufferHelper.writeVarInt(outbuf, content.readableBytes());
        outbuf.write(raw,content.getReadIndex(), content.readableBytes());
        break;
      }
      case QUICKLZ:
      {
        try
View Full Code Here

      case QUICKLZ:
      {
        try
        {
          byte[] newbuf = QuickLZ.compress(raw,
                  content.getReadIndex(), content.readableBytes(), 1);
          BufferHelper.writeVarInt(outbuf, newbuf.length);
          outbuf.write(newbuf);
        }
        catch (Exception e)
        {
View Full Code Here

        JFastLZ fastlz = new JFastLZ();
        int afterCompress;
        try
        {
          afterCompress = fastlz.fastlzCompress(raw,
                  content.getReadIndex(), content.readableBytes(),
                  newbuf, 0, newbuf.length);
          BufferHelper.writeVarInt(outbuf, afterCompress);
          outbuf.write(newbuf, 0, afterCompress);
        }
        catch (IOException e)
View Full Code Here

      }
      case SNAPPY:
      {
        try
        {
          byte[] newbuf = new byte[Snappy.maxCompressedLength(content.readableBytes())];
          int len = Snappy.compress(raw,
                  content.getReadIndex(), content.readableBytes(), newbuf, 0);
//          SnappyBuffer newbuf = SnappyCompressor.compress(raw,
//                  content.getReadIndex(), content.readableBytes());
          BufferHelper.writeVarInt(outbuf, len);
View Full Code Here

      {
        try
        {
          byte[] newbuf = new byte[Snappy.maxCompressedLength(content.readableBytes())];
          int len = Snappy.compress(raw,
                  content.getReadIndex(), content.readableBytes(), newbuf, 0);
//          SnappyBuffer newbuf = SnappyCompressor.compress(raw,
//                  content.getReadIndex(), content.readableBytes());
          BufferHelper.writeVarInt(outbuf, len);
          outbuf.write(newbuf, 0, len);
        }
View Full Code Here

      case LZF:
      {
        try
        {
          byte[] newbuf = LZFEncoder.encode(raw,
                  content.readableBytes());
          BufferHelper.writeVarInt(outbuf, newbuf.length);
          outbuf.write(newbuf);
        }
        catch (Exception e)
        {
View Full Code Here

      default:
      {
        break;
      }
    }
    buffer.write(content, content.readableBytes());
    return true;
  }
}
View Full Code Here

    byte[] raw = content.getRawBuffer();
    switch (type)
    {
      case NONE:
      {
        outbuf.write(raw,content.getReadIndex(), content.readableBytes());
        break;
      }
      case QUICKLZ:
      {
        try
View Full Code Here

      case QUICKLZ:
      {
        try
        {
          byte[] newbuf = QuickLZ.compress(raw,
                  content.getReadIndex(), content.readableBytes(), 1);
          outbuf.write(newbuf);
        }
        catch (Exception e)
        {
          //logger.error("Failed to compress by QuickLZ.", e);
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.