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

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

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

IOUtils.readInt介绍

[英]Read an integer (4 bytes).
[中]读取一个整数(4字节)。

代码示例

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

/**
 * Read a long (8 bytes).
 *
 * @param in the input stream
 * @return the value
 * @throws IOException if an IO exception occurred while reading.
 */
public static long readLong(InputStream in) throws IOException {
  return ((long) (readInt(in)) << 32) + (readInt(in) & 0xffffffffL);
}

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

/**
 * Read a long (8 bytes).
 *
 * @param in the input stream
 * @return the value
 * @throws IOException if an IO exception occurred while reading.
 */
public static long readLong(InputStream in) throws IOException {
  return ((long) (readInt(in)) << 32) + (readInt(in) & 0xffffffffL);
}

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

/**
 * Read a long (8 bytes).
 *
 * @param in the input stream
 * @return the value
 * @throws IOException if an IO exception occurred while reading.
 */
public static long readLong(InputStream in) throws IOException {
  return ((long) (readInt(in)) << 32) + (readInt(in) & 0xffffffffL);
}

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

private static void testInt(int x) throws IOException {
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  IOUtils.writeInt(out, x);
  byte[] data = out.toByteArray();
  assertTrue(data.length == Integer.BYTES);
  ByteArrayInputStream in = new ByteArrayInputStream(data);
  int x2 = IOUtils.readInt(in);
  assertEquals(x, x2);
  assertEquals(-1, in.read());
}

相关文章