本文整理了Java中org.apache.jackrabbit.oak.commons.IOUtils.writeLong()
方法的一些代码示例,展示了IOUtils.writeLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.writeLong()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.commons.IOUtils
类名称:IOUtils
方法名:writeLong
[英]Write a long (8 bytes).
[中]写一个长的(8字节)。
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void call() throws Exception {
int i = id.getAndIncrement();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.writeLong(out, i);
out.write(EMPTY);
byte[] data = out.toByteArray();
String id = store.writeBlob(new ByteArrayInputStream(data));
Assert.assertEquals(58, store.getBlobLength(id));
byte[] test = out.toByteArray();
Assert.assertEquals(8, store.readBlob(id, 0, test, 0, 8));
Assert.assertTrue(Arrays.equals(data, test));
}
});
代码示例来源:origin: apache/jackrabbit-oak
private static void testLong(long x) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.writeLong(out, x);
byte[] data = out.toByteArray();
assertTrue(data.length == Long.BYTES);
ByteArrayInputStream in = new ByteArrayInputStream(data);
long x2 = IOUtils.readLong(in);
assertEquals(x, x2);
assertEquals(-1, in.read());
}
内容来源于网络,如有侵权,请联系作者删除!