当前位置: 首页>>代码示例>>Java>>正文


Java Snappy.getUncompressedLength方法代码示例

本文整理汇总了Java中org.iq80.snappy.Snappy.getUncompressedLength方法的典型用法代码示例。如果您正苦于以下问题:Java Snappy.getUncompressedLength方法的具体用法?Java Snappy.getUncompressedLength怎么用?Java Snappy.getUncompressedLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.iq80.snappy.Snappy的用法示例。


在下文中一共展示了Snappy.getUncompressedLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decompress

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
public void decompress(byte[] value, int offset, int len) {
	if (value[offset] == 0) {
		grow(Snappy.getUncompressedLength(value, offset + 1));
		end = Snappy.uncompress(value, offset + 1, len - 1, buffer, 0);
	} else {
		int s = Utils.decodeInt(value, offset + 1);
		// Calculate uncompress size
		offset += 5;
		len -= 5;
		int un_s = Snappy.getUncompressedLength(value, offset);
		un_s += Snappy.getUncompressedLength(value, offset + s);
		grow(un_s);

		end = Snappy.uncompress(value, offset, s, buffer, 0);
		end += Snappy.uncompress(value, offset + s, len - s, buffer, end);
	}
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:18,代码来源:ByteArray.java

示例2: uncompressCharSequence

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
@NotNull
public static CharSequence uncompressCharSequence(@NotNull Object string, @NotNull Charset charset) {
  if (string instanceof CharSequence) return (CharSequence)string;
  byte[] b = (byte[])string;
  try {
    int uncompressedLength = Snappy.getUncompressedLength(b, 0);
    byte[] bytes = spareBufferLocal.getBuffer(uncompressedLength);
    int bytesLength = Snappy.uncompress(b, 0, b.length, bytes, 0);
    return new String(bytes, 0, bytesLength, charset);
  }
  catch (CorruptionException ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CompressionUtil.java

示例3: uncompressStringRawBytes

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
@NotNull
public static CharSequence uncompressStringRawBytes(@NotNull Object compressed) {
  if (compressed instanceof CharSequence) return (CharSequence)compressed;
  byte[] b = (byte[])compressed;
  try {
    int uncompressedLength = Snappy.getUncompressedLength(b, 0);
    byte[] bytes = spareBufferLocal.getBuffer(uncompressedLength);
    int bytesLength = Snappy.uncompress(b, 0, b.length, bytes, 0);
    ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes, 0, bytesLength);
    @NotNull DataInput in = new DataInputStream(byteStream);

    int len = DataInputOutputUtil.readINT(in);
    char[] chars = new char[len];

    for (int i=0; i<len; i++) {
      int c = DataInputOutputUtil.readINT(in);
      chars[i] = (char)c;
    }
    return StringFactory.createShared(chars);
  }
  catch (CorruptionException ex) {
    throw new RuntimeException(ex);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:CompressionUtil.java

示例4: decompressSnappy

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
private int decompressSnappy(Slice in)
        throws IOException
{
    byte[] inArray = (byte[]) in.getBase();
    int inOffset = (int) (in.getAddress() - ARRAY_BYTE_BASE_OFFSET);
    int inLength = in.length();

    int uncompressedLength = Snappy.getUncompressedLength(inArray, inOffset);
    checkArgument(uncompressedLength <= maxBufferSize, "Snappy requires buffer (%s) larger than max size (%s)", uncompressedLength, maxBufferSize);
    allocateOrGrowBuffer(uncompressedLength, false);

    return Snappy.uncompress(inArray, inOffset, inLength, buffer, 0);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:14,代码来源:OrcInputStream.java

示例5: uncompressCharSequence

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
@Nonnull
public static CharSequence uncompressCharSequence(@Nonnull Object string, @Nonnull Charset charset) {
  if (string instanceof CharSequence) return (CharSequence)string;
  byte[] b = (byte[])string;
  try {
    int uncompressedLength = Snappy.getUncompressedLength(b, 0);
    byte[] bytes = spareBufferLocal.getBuffer(uncompressedLength);
    int bytesLength = Snappy.uncompress(b, 0, b.length, bytes, 0);
    return new String(bytes, 0, bytesLength, charset);
  }
  catch (CorruptionException ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:CompressionUtil.java

示例6: uncompressStringRawBytes

import org.iq80.snappy.Snappy; //导入方法依赖的package包/类
@Nonnull
public static CharSequence uncompressStringRawBytes(@Nonnull Object compressed) {
  if (compressed instanceof CharSequence) return (CharSequence)compressed;
  byte[] b = (byte[])compressed;
  try {
    int uncompressedLength = Snappy.getUncompressedLength(b, 0);
    byte[] bytes = spareBufferLocal.getBuffer(uncompressedLength);
    int bytesLength = Snappy.uncompress(b, 0, b.length, bytes, 0);
    ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes, 0, bytesLength);
    @Nonnull DataInput in = new DataInputStream(byteStream);

    int len = DataInputOutputUtil.readINT(in);
    char[] chars = new char[len];

    for (int i=0; i<len; i++) {
      int c = DataInputOutputUtil.readINT(in);
      chars[i] = (char)c;
    }
    return StringFactory.createShared(chars);
  }
  catch (CorruptionException ex) {
    throw new RuntimeException(ex);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:CompressionUtil.java


注:本文中的org.iq80.snappy.Snappy.getUncompressedLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。