org.apache.jackrabbit.oak.commons.IOUtils.writeVarLong()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.apache.jackrabbit.oak.commons.IOUtils.writeVarLong()方法的一些代码示例,展示了IOUtils.writeVarLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.writeVarLong()方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.commons.IOUtils
类名称:IOUtils
方法名:writeVarLong

IOUtils.writeVarLong介绍

[英]Write a variable size long. Negative values need 10 bytes.
[中]写一个可变大小的长文件。负值需要10个字节。

代码示例

代码示例来源:origin: org.apache.jackrabbit/oak-mk

@Override
public void write(String key, long value) throws Exception {
  if (out == null) {
    throw new IllegalStateException("no OutputStream provided");
  }
  IOUtils.writeVarLong(out, value);
}

代码示例来源:origin: org.apache.jackrabbit/oak-blob

idStream.write(TYPE_HASH);
IOUtils.writeVarInt(idStream, 0);
IOUtils.writeVarLong(idStream, length);
byte[] digest = messageDigest.digest();
File f = getFile(digest, false);

代码示例来源:origin: apache/jackrabbit-oak

idStream.write(TYPE_HASH);
IOUtils.writeVarInt(idStream, 0);
IOUtils.writeVarLong(idStream, length);
byte[] digest = messageDigest.digest();
File f = getFile(digest, false);

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

idStream.write(TYPE_HASH);
IOUtils.writeVarInt(idStream, 0);
IOUtils.writeVarLong(idStream, length);
byte[] digest = messageDigest.digest();
File f = getFile(digest, false);

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

IOUtils.writeVarLong(idStream, totalLength);
IOUtils.writeVarLong(idStream, blockLen);
totalLength += blockLen;
IOUtils.writeVarInt(idStream, digest.length);

代码示例来源:origin: apache/jackrabbit-oak

IOUtils.writeVarLong(idStream, totalLength);
IOUtils.writeVarLong(idStream, blockLen);
totalLength += blockLen;
IOUtils.writeVarInt(idStream, digest.length);

代码示例来源:origin: org.apache.jackrabbit/oak-blob

IOUtils.writeVarLong(idStream, totalLength);
IOUtils.writeVarLong(idStream, blockLen);
totalLength += blockLen;
IOUtils.writeVarInt(idStream, digest.length);

代码示例来源:origin: apache/jackrabbit-oak

private static void testVarLong(long x, int expectedLen) throws IOException {
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  IOUtils.writeVarLong(out, x);
  byte[] data = out.toByteArray();
  assertTrue(data.length <= 10);
  if (expectedLen > 0) {
    assertEquals(expectedLen, data.length);
  }
  ByteArrayInputStream in = new ByteArrayInputStream(data);
  long x2 = IOUtils.readVarLong(in);
  assertEquals(x, x2);
  assertEquals(-1, in.read());
}

相关文章