本文整理汇总了Java中com.google.gwt.typedarrays.client.Int8ArrayNative类的典型用法代码示例。如果您正苦于以下问题:Java Int8ArrayNative类的具体用法?Java Int8ArrayNative怎么用?Java Int8ArrayNative使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Int8ArrayNative类属于com.google.gwt.typedarrays.client包,在下文中一共展示了Int8ArrayNative类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toByteArray
import com.google.gwt.typedarrays.client.Int8ArrayNative; //导入依赖的package包/类
/** @param arrayBuffer will be converted to byte array.
* @return byte array with values stored in the buffer. */
protected static byte[] toByteArray(final ArrayBuffer arrayBuffer) {
final Int8Array array = Int8ArrayNative.create(arrayBuffer);
final int length = array.byteLength();
final byte[] byteArray = new byte[length];
for (int index = 0; index < length; index++) {
byteArray[index] = array.get(index);
}
return byteArray;
}
示例2: sendBinary
import com.google.gwt.typedarrays.client.Int8ArrayNative; //导入依赖的package包/类
@Override
public void sendBinary(final byte[] message) {
final ArrayBuffer arrayBuffer = ArrayBufferNative.create(message.length);
final Int8Array array = Int8ArrayNative.create(arrayBuffer);
array.set(message);
try {
sendArrayBuffer(arrayBuffer);
} catch (final Throwable exception) {
throw new WebSocketException(exception);
}
}
示例3: DirectByteBuffer
import com.google.gwt.typedarrays.client.Int8ArrayNative; //导入依赖的package包/类
DirectByteBuffer (ArrayBuffer buffer, int capacity, int offset) {
super(capacity);
byteArray = Int8ArrayNative.create(buffer, offset, capacity);
}