Examples of JFastLZ


Examples of org.arch.compress.fastlz.JFastLZ

        case FASTLZ:
        {
          int len = buffer.readableBytes() * 10;
          try
          {
            JFastLZ fastlz = new JFastLZ();
            byte[] newbuf = new byte[len];
            int decompressed = fastlz.fastlzDecompress(raw,
                    buffer.getReadIndex(), size,
                    newbuf, 0, len);
            content = Buffer.wrapReadableContent(newbuf, 0,
                    decompressed);
          }
View Full Code Here

Examples of org.arch.compress.fastlz.JFastLZ

        break;
      }
      case FASTLZ:
      {
        byte[] newbuf = new byte[raw.length];
        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);
        }
View Full Code Here

Examples of org.arch.compress.fastlz.JFastLZ

        case FASTLZ:
        {
          int len = buffer.readableBytes() * 10;
          try
          {
            JFastLZ fastlz = new JFastLZ();
            byte[] newbuf = new byte[len];
            int decompressed = fastlz.fastlzDecompress(raw,
                    buffer.getReadIndex(), buffer.readableBytes(),
                    newbuf, 0, len);
            content = Buffer.wrapReadableContent(newbuf, 0,
                    decompressed);
          }
View Full Code Here

Examples of org.arch.compress.fastlz.JFastLZ

        break;
      }
      case FASTLZ:
      {
        byte[] newbuf = new byte[raw.length];
        JFastLZ fastlz = new JFastLZ();
        int afterCompress;
        try
        {
          afterCompress = fastlz.fastlzCompress(raw,
                  content.getReadIndex(), content.readableBytes(),
                  newbuf, 0, newbuf.length);
          outbuf.write(newbuf, 0, afterCompress);
        }
        catch (IOException e)
View Full Code Here

Examples of org.arch.compress.fastlz.JFastLZ

    byte[] buffer = new byte[1024 * 1024];
    int len = fis.read(buffer);
    byte[] cmp = new byte[len];

    System.arraycopy(buffer, 0, cmp, 0, len);
    JFastLZ fastlz = new JFastLZ();
    byte[] newbuf = new byte[len];
    long start = System.currentTimeMillis();
    for (int i = 0; i < loopcount; i++)
    {
      int newlen = fastlz.fastlzCompress(JFastLZLevel.One, cmp, 0,
              cmp.length, newbuf, 0, newbuf.length);
    }
    long end = System.currentTimeMillis();
    int newlen = fastlz.fastlzCompress(JFastLZLevel.One, cmp, 0,
            cmp.length, newbuf, 0, newbuf.length);
    System.out.println("FastLZ Compressed size:" + newlen
            + " for uncompressed size:" + len + ", cost " + (end - start)
            + "ms");
    start = System.currentTimeMillis();
    for (int i = 0; i < loopcount; i++)
    {
      int newlen2 = fastlz.fastlzDecompress(newbuf, 0, newlen, buffer, 0,
              buffer.length);
    }
    end = System.currentTimeMillis();
    int newlen2 = fastlz.fastlzDecompress(newbuf, 0, newlen, buffer, 0,
            buffer.length);
    byte[] resume = new byte[newlen2];
    System.arraycopy(buffer, 0, resume, 0, newlen2);
    System.out.println("FastLZ Decompress cost " + (end - start) + "ms");
    assertArrayEquals(cmp, resume);
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.