Snappy-Java Source Code

Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google.

Snappy-Java Source Code files are provided in the source packge (snappy-java-1.1.8.4-sources.jar). You can download it at Snappy Maven Website.

You can also browse Snappy-Java Source Code below:

✍: FYIcenter.com

org/xerial/snappy/pool/QuiescentBufferPool.java

package org.xerial.snappy.pool;

import java.nio.ByteBuffer;

/**
 * A {@link BufferPool} implementation which does no pooling. New instances will be created for each call to allocate.
 * @author Brett Okken
 */
public final class QuiescentBufferPool implements BufferPool {

    private static final QuiescentBufferPool INSTANCE = new QuiescentBufferPool();

    private QuiescentBufferPool() {
    }

    /**
     * @return Instance of {@link BufferPool} which does no caching/reuse of instances.
     */
    public static BufferPool getInstance() {
        return INSTANCE;
    }
    
    /**
     * Creates a new {@code byte[]} of <i>size</i>.
     */
    @Override
    public byte[] allocateArray(int size) {
        return new byte[size];
    }

    /**
     * Does nothing.
     */
    @Override
    public void releaseArray(byte[] buffer) {
    }

    /**
     * {@link ByteBuffer#allocateDirect(int) Allocates} a direct {@link ByteBuffer} of <i>size</i>.
     */
    @Override
    public ByteBuffer allocateDirect(int size) {
        return ByteBuffer.allocateDirect(size);
    }

    /**
     * Aggressively releases native resources associated with <i>buffer</i>.
     */
    @Override
    public void releaseDirect(ByteBuffer buffer) {
        assert buffer != null && buffer.isDirect();
        DirectByteBuffers.releaseDirectByteBuffer(buffer);
    }

}

org/xerial/snappy/pool/QuiescentBufferPool.java

 

Or download all of them as a single archive file:

File name: snappy-java-1.1.8.4-sources.jar
File size: 1962098 bytes
Release date: 2021-01-25
Download 

 

Download and Install Snappy-Java Binary Package

What Is Snappy-Java

Downloading and Reviewing snappy-java.jar

⇑⇑ Snappy-Java - Compresser and Decompresser

2021-07-13, 18963👍, 0💬