Codota Logo
CompressLZF.compress
Code IndexAdd Codota to your IDE (free)

How to use
compress
method
in
org.h2.compress.CompressLZF

Best Java code snippets using org.h2.compress.CompressLZF.compress (Showing top 14 results out of 315)

  • Common ways to obtain CompressLZF
private void myMethod () {
CompressLZF c =
  • Codota Iconnew CompressLZF()
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

/**
 * Compress the data in a byte array.
 *
 * @param page which page to compress
 */
void compressPage(int page) {
  final ByteBuffer d = buffers[page].get();
  synchronized (d) {
    if (d.capacity() != BLOCK_SIZE) {
      // already compressed
      return;
    }
    final byte[] compressOutputBuffer = COMPRESS_OUT_BUF_THREAD_LOCAL.get();
    int len = LZF_THREAD_LOCAL.get().compress(d, 0, compressOutputBuffer, 0);
    ByteBuffer out = ByteBuffer.allocateDirect(len);
    out.put(compressOutputBuffer, 0, len);
    buffers[page].compareAndSet(d, out);
  }
}
origin: com.h2database/h2

/**
 * Compress the data in a byte array.
 *
 * @param page which page to compress
 */
void compress(int page) {
  byte[] old = getPage(page);
  if (old == null || old.length != BLOCK_SIZE) {
    // not yet initialized or already compressed
    return;
  }
  synchronized (LZF) {
    int len = LZF.compress(old, BLOCK_SIZE, BUFFER, 0);
    if (len <= BLOCK_SIZE) {
      byte[] d = Arrays.copyOf(BUFFER, len);
      // maybe data was changed in the meantime
      setPage(page, old, d, false);
    }
  }
}
origin: com.h2database/h2

private void compressAndWrite(byte[] buff, int len) throws IOException {
  if (len > 0) {
    ensureOutput(len);
    int compressed = compress.compress(buff, len, outBuffer, 0);
    if (compressed > len) {
      writeInt(-len);
      out.write(buff, 0, len);
    } else {
      writeInt(compressed);
      writeInt(len);
      out.write(outBuffer, 0, compressed);
    }
  }
}
origin: com.h2database/h2

int pageSize = store.getPageSize();
if (COMPRESS_UNDO) {
  int size = compress.compress(page.getBytes(),
      pageSize, compressBuffer, 0);
  if (size < pageSize) {
origin: com.h2database/com.springsource.org.h2

private static void compress(byte[][] data, int i) {
  byte[] d = data[i];
  synchronized (LZF) {
    int len = LZF.compress(d, BLOCK_SIZE, BUFFER, 0);
    if (len <= BLOCK_SIZE) {
      d = new byte[len];
      System.arraycopy(BUFFER, 0, d, 0, len);
      data[i] = d;
    }
  }
}
 
origin: com.eventsourcing/h2

/**
 * Compress the data in a byte array.
 *
 * @param data the page array
 * @param page which page to compress
 */
static void compress(byte[][] data, int page) {
  byte[] d = data[page];
  synchronized (LZF) {
    int len = LZF.compress(d, BLOCK_SIZE, BUFFER, 0);
    if (len <= BLOCK_SIZE) {
      d = new byte[len];
      System.arraycopy(BUFFER, 0, d, 0, len);
      data[page] = d;
    }
  }
}
origin: com.eventsourcing/h2

/**
 * Compress the data in a byte array.
 *
 * @param data the page array
 * @param page which page to compress
 */
static void compress(ByteBuffer[] data, int page) {
  ByteBuffer d = data[page];
  synchronized (LZF) {
    int len = LZF.compress(d, 0, BUFFER, 0);
    d = ByteBuffer.allocateDirect(len);
    d.put(BUFFER, 0, len);
    data[page] = d;
  }
}
origin: org.wowtools/h2

/**
 * Compress the data in a byte array.
 *
 * @param page which page to compress
 */
void compress(int page) {
  ByteBuffer[] list = data;
  if (page >= list.length) {
    // was truncated
    return;
  }
  ByteBuffer d = list[page];
  synchronized (LZF) {
    int len = LZF.compress(d, 0, BUFFER, 0);
    d = ByteBuffer.allocateDirect(len);
    d.put(BUFFER, 0, len);
    list[page] = d;
  }
}
origin: org.wowtools/h2

/**
 * Compress the data in a byte array.
 *
 * @param page which page to compress
 * @param old the page array
 */
void compress(int page, byte[] old) {
  byte[][] array = data;
  if (page >= array.length) {
    return;
  }
  byte[] d = array[page];
  if (d != old) {
    return;
  }
  synchronized (LZF) {
    int len = LZF.compress(d, BLOCK_SIZE, BUFFER, 0);
    if (len <= BLOCK_SIZE) {
      d = new byte[len];
      System.arraycopy(BUFFER, 0, d, 0, len);
      // maybe data was changed in the meantime
      byte[] o = array[page];
      if (o != old) {
        return;
      }
      array[page] = d;
    }
  }
}
origin: com.h2database/com.springsource.org.h2

private void compressAndWrite(byte[] buff, int len) throws IOException {
  if (len > 0) {
    ensureOutput(len);
    int compressed = compress.compress(buff, len, outBuffer, 0);
    if (compressed > len) {
      writeInt(-len);
      out.write(buff, 0, len);
    } else {
      writeInt(compressed);
      writeInt(len);
      out.write(outBuffer, 0, compressed);
    }
  }
}
origin: org.wowtools/h2

private void compressAndWrite(byte[] buff, int len) throws IOException {
  if (len > 0) {
    ensureOutput(len);
    int compressed = compress.compress(buff, len, outBuffer, 0);
    if (compressed > len) {
      writeInt(-len);
      out.write(buff, 0, len);
    } else {
      writeInt(compressed);
      writeInt(len);
      out.write(outBuffer, 0, compressed);
    }
  }
}
origin: com.eventsourcing/h2

private void compressAndWrite(byte[] buff, int len) throws IOException {
  if (len > 0) {
    ensureOutput(len);
    int compressed = compress.compress(buff, len, outBuffer, 0);
    if (compressed > len) {
      writeInt(-len);
      out.write(buff, 0, len);
    } else {
      writeInt(compressed);
      writeInt(len);
      out.write(outBuffer, 0, compressed);
    }
  }
}
origin: org.wowtools/h2

int pageSize = store.getPageSize();
if (COMPRESS_UNDO) {
  int size = compress.compress(page.getBytes(),
      pageSize, compressBuffer, 0);
  if (size < pageSize) {
origin: com.eventsourcing/h2

int pageSize = store.getPageSize();
if (COMPRESS_UNDO) {
  int size = compress.compress(page.getBytes(),
      pageSize, compressBuffer, 0);
  if (size < pageSize) {
org.h2.compressCompressLZFcompress

Javadoc

Compress a number of bytes.

Popular methods of CompressLZF

  • <init>
  • expand
  • first
    Return the integer with the first two bytes 0, then the bytes at the index, then at index+1.
  • hash
    Compute the address in the hash table.
  • next
    Shift the value 1 byte left, and add the byte at index inPos+2.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now