Tabnine Logo
SnappyInputStream
Code IndexAdd Tabnine to your IDE (free)

How to use
SnappyInputStream
in
org.xerial.snappy

Best Java code snippets using org.xerial.snappy.SnappyInputStream (Showing top 20 results out of 369)

origin: redisson/redisson

@Override
protected InputStream createInputStream(InputStream parent) throws IOException {
  return new SnappyInputStream(parent);
}
origin: apache/flume

try {
 in = new BufferedInputStream(new FileInputStream(compressed));
 snappyIn = new SnappyInputStream(in);
 out = new FileOutputStream(decompressed);
  int read = snappyIn.read(buf);
  if (read == -1) {
   break;
   snappyIn.close();
origin: redisson/redisson

/**
 * Reads the next byte of uncompressed data from the input stream. The value
 * byte is returned as an int in the range 0 to 255. If no byte is available
 * because the end of the stream has been reached, the value -1 is returned.
 * This method blocks until input data is available, the end of the stream
 * is detected, or an exception is thrown.
 */
/* (non-Javadoc)
 * @see java.io.InputStream#read()
 */
@Override
public int read()
    throws IOException
{
  if (uncompressedCursor < uncompressedLimit) {
    return uncompressed[uncompressedCursor++] & 0xFF;
  }
  else {
    if (hasNextChunk()) {
      return read();
    }
    else {
      return -1;
    }
  }
}
origin: Netflix/Priam

  private void decompress(InputStream input, OutputStream output) throws IOException {
    byte data[] = new byte[BUFFER];
    try (BufferedOutputStream dest1 = new BufferedOutputStream(output, BUFFER);
        SnappyInputStream is = new SnappyInputStream(new BufferedInputStream(input))) {
      int c;
      while ((c = is.read(data, 0, BUFFER)) != -1) {
        dest1.write(data, 0, c);
      }
    }
  }
}
origin: redisson/redisson

/**
 * Read int array from the stream
 *
 * @param d
 * @return the total number of bytes read into the buffer, or -1 if there is
 * no more data because the end of the stream has been reached.
 * @throws IOException
 */
public int read(int[] d)
    throws IOException
{
  return read(d, 0, d.length);
}
origin: pentaho/pentaho-kettle

@Override
public void close() throws IOException {
 ( (SnappyInputStream) delegate ).close();
}
origin: apache/nifi

final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (final SnappyInputStream sis = new SnappyInputStream(new ByteArrayInputStream(flowFile.toByteArray())); final OutputStream out = baos) {
  final byte[] buffer = new byte[8192]; int len;
  while ((len = sis.read(buffer)) > 0) {
    out.write(buffer, 0, len);
origin: redisson/redisson

/**
 * Read float array from the stream
 *
 * @param d
 * @return the total number of bytes read into the buffer, or -1 if there is
 * no more data because the end of the stream has been reached.
 * @throws IOException
 */
public int read(float[] d)
    throws IOException
{
  return read(d, 0, d.length);
}
origin: pentaho/pentaho-kettle

protected static SnappyInputStream getDelegate( InputStream in ) throws IOException {
 SnappyInputStream delegate = null;
 if ( in instanceof SnappyInputStream ) {
  delegate = (SnappyInputStream) in;
 } else {
  delegate = new SnappyInputStream( in );
 }
 return delegate;
}
origin: eu.fbk.twm/twm-index

public Decompress(File in, File out) {
  long begin = System.currentTimeMillis();
  logger.info("decompressing" + new Date() + "...");
  logger.info("in:\t" + in + " (" + df.format(in.length()) + ")");
  logger.info("out:\t" + out);
  byte[] buffer = new byte[1024];
  try {
    SnappyInputStream sis = new SnappyInputStream(new FileInputStream(in));
    FileOutputStream fos = new FileOutputStream(out);
    int len;
    while ((len = sis.read(buffer)) > 0) {
      fos.write(buffer, 0, len);
    }
    sis.close();
    fos.close();
  } catch (IOException e) {
    logger.error(e);
  }
  long end = System.currentTimeMillis();
  logger.info("decompression done in " + df.format(end - begin) + " ms (" + new Date() + ")");
}
origin: mesosphere/dcos-cassandra-service

  @Override
  public void decompress(InputStream source, OutputStream destination)
      throws IOException {
    SnappyInputStream compressedInputStream = null;
    BufferedOutputStream output = null;
    try {
      compressedInputStream = new SnappyInputStream(
          new BufferedInputStream(source));
      output = new BufferedOutputStream(destination, DEFAULT_BUFFER_SIZE);

      int bytesRead;
      byte[] data = new byte[DEFAULT_BUFFER_SIZE];
      while ((bytesRead = compressedInputStream.read(data, 0,
          DEFAULT_BUFFER_SIZE)) != -1) {
        output.write(data, 0, bytesRead);
      }
    } finally {
      IOUtils.closeQuietly(compressedInputStream);
      IOUtils.closeQuietly(output);
    }
  }
}
origin: redisson/redisson

/**
 * Read long array from the stream
 *
 * @param d
 * @return the total number of bytes read into the buffer, or -1 if there is
 * no more data because the end of the stream has been reached.
 * @throws IOException
 */
public int read(long[] d)
    throws IOException
{
  return read(d, 0, d.length);
}
origin: org.mongodb/mongo-java-driver

  @Override
  InputStream getInputStream(final InputStream source) throws IOException {
    return new SnappyInputStream(source);
  }
}
origin: com.netflix.astyanax/astyanax-cassandra

try {
  ByteBuffer dup = byteBuffer.duplicate();
  snappy = new SnappyInputStream(
      new ByteArrayInputStream(dup.array(), 0,
          dup.limit()));
    value = snappy.read();
    if (value != -1) {
      baos.write(value);
  snappy.close();
  baos.close();
  return StringUtils.newStringUtf8(baos.toByteArray());
  if (snappy != null) {
    try {
      snappy.close();
    } catch (IOException e) {
origin: redisson/redisson

/**
 * Read double array from the stream
 *
 * @param d
 * @return the total number of bytes read into the buffer, or -1 if there is
 * no more data because the end of the stream has been reached.
 * @throws IOException
 */
public int read(double[] d)
    throws IOException
{
  return read(d, 0, d.length);
}
origin: pentaho/pentaho-kettle

 private SnappyInputStream createSnappyInputStream() throws IOException {
  // Create an in-memory ZIP output stream for use by the input stream (to avoid exceptions)
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  SnappyOutputStream sos = new SnappyOutputStream( baos );
  byte[] testBytes = "Test".getBytes();
  sos.write( testBytes );
  ByteArrayInputStream in = new ByteArrayInputStream( baos.toByteArray() );
  sos.close();

  return new SnappyInputStream( in );
 }
}
origin: org.apache.flume.flume-ng-channels/flume-file-channel

try {
 in = new BufferedInputStream(new FileInputStream(compressed));
 snappyIn = new SnappyInputStream(in);
 out = new FileOutputStream(decompressed);
  int read = snappyIn.read(buf);
  if (read == -1) {
   break;
   snappyIn.close();
origin: redisson/redisson

/**
 * Read short array from the stream
 *
 * @param d
 * @return the total number of bytes read into the buffer, or -1 if there is
 * no more data because the end of the stream has been reached.
 * @throws IOException
 */
public int read(short[] d)
    throws IOException
{
  return read(d, 0, d.length);
}
origin: pentaho/pentaho-kettle

 private SnappyInputStream createSnappyInputStream() throws IOException {
  // Create an in-memory ZIP output stream for use by the input stream (to avoid exceptions)
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  SnappyOutputStream sos = new SnappyOutputStream( baos );
  byte[] testBytes = "Test".getBytes();
  sos.write( testBytes );
  ByteArrayInputStream in = new ByteArrayInputStream( baos.toByteArray() );
  sos.close();

  return new SnappyInputStream( in );
 }
}
origin: pentaho/pentaho-kettle

@Override
public int read() throws IOException {
 return ( (SnappyInputStream) delegate ).read();
}
org.xerial.snappySnappyInputStream

Javadoc

A stream filter for reading data compressed by SnappyOutputStream.

Most used methods

  • <init>
  • read
  • close
  • hasNextChunk
  • isValidHeader
  • rawRead
    Read uncompressed data into the specified array
  • readFully
  • readHeader
  • readNext
    Read next len bytes

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Option (scala)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now