com.eclipsesource.v8.V8Array.getBytes()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(70)

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

V8Array.getBytes介绍

[英]Returns the bytes contained in a subset of a V8Array. If the subset contains elements that cannot be cast to bytes, then a V8ResultUndefined exception is thrown. Furthermore, if the subset is not entirely contained within the array, then V8ResultUndefined exception is also thrown.
[中]返回V8Array子集中包含的字节。如果子集包含无法转换为字节的元素,则会引发V8ResultUndefined异常。此外,如果子集不完全包含在数组中,那么也会抛出V8ResultUndefined异常。

代码示例

代码示例来源:origin: eclipsesource/J2V8

byteArray = new byte[length];
array.getBytes(0, length, byteArray);
return byteArray;

代码示例来源:origin: eclipsesource/J2V8

@Test(expected = UnsupportedOperationException.class)
public void testGetBytesUndefined2() {
  V8Array undefined = v8.getArray("array");
  undefined.getBytes(0, 10, new byte[10]);
}

代码示例来源:origin: eclipsesource/J2V8

@Test(expected = UnsupportedOperationException.class)
public void testGetBytesUndefined() {
  V8Array undefined = v8.getArray("array");
  undefined.getBytes(0, 10);
}

代码示例来源:origin: eclipsesource/J2V8

@Test(expected = IndexOutOfBoundsException.class)
public void testGetBytesSmallerArray() {
  V8Array a = v8.executeArrayScript("[0, 1, 2, 3]");
  byte[] result = new byte[3];
  try {
    a.getBytes(0, 4, result);
  } finally {
    a.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

byteArray = new byte[length];
array.getBytes(0, length, byteArray);
return byteArray;

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetBytesSameSizeArray() {
  V8Array a = v8.executeArrayScript("[0, 1, 2, 3]");
  byte[] result = new byte[4];
  int size = a.getBytes(0, 4, result);
  assertEquals(4, size);
  a.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetBytesBiggerArray() {
  V8Array a = v8.executeArrayScript("[0, 1, 2, 3]");
  byte[] result = new byte[40];
  int size = a.getBytes(0, 4, result);
  assertEquals(4, size);
  a.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetBytesPopulatesArray() {
  V8Array a = v8.executeArrayScript("[0, 1, 2, 256]");
  byte[] result = new byte[4];
  a.getBytes(0, 4, result);
  assertEquals(0, result[0]);
  assertEquals(1, result[1]);
  assertEquals(2, result[2]);
  assertEquals(0, result[3]);
  a.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetArrayOfBytes() {
  V8Array a = v8.executeArrayScript("[0, 1, 2, 3, 256];");
  byte[] result = a.getBytes(0, 5);
  assertEquals(5, result.length);
  assertEquals(0, result[0]);
  assertEquals(1, result[1]);
  assertEquals(2, result[2]);
  assertEquals(3, result[3]);
  assertEquals(0, result[4]);
  a.close();
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

byteArray = new byte[length];
array.getBytes(0, length, byteArray);
return byteArray;

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

byteArray = new byte[length];
array.getBytes(0, length, byteArray);
return byteArray;

相关文章