当前位置: 首页>>代码示例>>Java>>正文


Java Uint8Array.set方法代码示例

本文整理汇总了Java中com.google.gwt.typedarrays.shared.Uint8Array.set方法的典型用法代码示例。如果您正苦于以下问题:Java Uint8Array.set方法的具体用法?Java Uint8Array.set怎么用?Java Uint8Array.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.typedarrays.shared.Uint8Array的用法示例。


在下文中一共展示了Uint8Array.set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putMethod

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
@Override
public Promise<HTTPResponse> putMethod(String url, byte[] contents) {
    return new Promise<>(resolver -> {
        JsHttpRequest request = JsHttpRequest.create();
        request.open("PUT", url);
        request.setRequestHeader("Content-Type", "application/octet-stream");
        request.setOnLoadHandler(request1 -> {
            if (request1.getReadyState() == 4) {
                if (request1.getStatus() >= 200 && request1.getStatus() < 300) {
                    resolver.result(new HTTPResponse(request1.getStatus(), null));
                } else {
                    resolver.error(new HTTPError(request1.getStatus()));
                }
            }
        });
        Uint8Array push = TypedArrays.createUint8Array(contents.length);
        for (int i = 0; i < contents.length; i++) {
            push.set(i, contents[i]);
        }
        request.send(push.buffer());
    });
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:23,代码来源:JsHttpProvider.java

示例2: send

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
@Override
public void send(ByteBuffer data) {
  int len = data.limit();
  // TODO(haustein) Sending the view directly does not work for some reason.
  // May be a chrome issue...?
  //  Object trick = data;
  // ArrayBufferView ta = ((HasArrayBufferView) trick).getTypedArray();
  // Int8Array view = Int8Array.create(ta.getBuffer(), ta.getByteOffset(), len)
  // ws.send(view);
  ArrayBuffer buf = TypedArrays.createArrayBuffer(len);
  Uint8Array view = TypedArrays.createUint8Array(buf);
  for (int i = 0; i < len; i++) {
    view.set(i, data.get(i));
  }
  ws.send(buf);
}
 
开发者ID:playn,项目名称:playn,代码行数:17,代码来源:HtmlWebSocket.java

示例3: setTile

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
public void setTile(TileInfo tileInfo, GMap bufferGMap) {
	if (bufferImageData == null || bufferImageData.getWidth() != bufferGMap.getDataWidth()
			|| bufferImageData.getHeight() != bufferGMap.getDataHeight()) {
		bufferImageData = bufferCanvas.getContext2d()
				.createImageData(bufferGMap.getDataWidth(), bufferGMap.getDataHeight());
	}
	Uint8Array imageArray = bufferImageData.getData().cast();
	imageArray.set(bufferGMap.getImageData());
	bufferCanvas.getContext2d().putImageData(bufferImageData, -bufferGMap.getBorder(), 0);

	CanvasElement tile = tiles.get(tileInfo);
	if (tile == null) {
		tile = createImage(bufferGMap.getDataWidth() - bufferGMap.getBorder(), bufferGMap.getDataHeight());
		tiles.put(new TileInfo(tileInfo), tile);
	}
	Context2d c = tile.getContext2d();
	c.setFillStyle("white");
	c.fillRect(0, 0, tileSize, tileSize);
	c.drawImage(bufferCanvas, 0, 0);
	for (Consumer<Integer> listener : tileListeners)
		listener.accept(tileInfo.page);
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:23,代码来源:DataStore.java

示例4: doSend

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
@Override
public void doSend(byte[] data) {
    // Log.d(TAG, "doSend");
    if (isClosed) {
        return;
    }
    Uint8Array push = TypedArrays.createUint8Array(data.length);
    for (int i = 0; i < data.length; i++) {
        push.set(i, data[i]);
    }
    send(push);
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:13,代码来源:WebSocketConnection.java

示例5: convertBytes

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
public static ArrayBuffer convertBytes(byte[] data) {
    Uint8Array push = TypedArrays.createUint8Array(data.length);
    for (int i = 0; i < data.length; i++) {
        push.set(i, data[i]);
    }
    return push.buffer();
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:8,代码来源:Conversion.java

示例6: dataImageAsBlob

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
/**
 * Creates a Blob instance for the raw image data-uri value.
 * @param data The image uri data.
 * @param mimeType The media type for the generated blob.
 */
public static Blob dataImageAsBlob(final String data,
                                   final String mimeType) {
    final String byteString = Window.atob(data);
    final ArrayBuffer buffer = ArrayBufferNative.create(byteString.length());
    final Uint8Array ia = Uint8ArrayNative.create(buffer);
    for (int i = 0; i < byteString.length(); i++) {
        ia.set(i,
               byteString.charAt(i));
    }
    return new BlobImpl(new Object[]{ia},
                        BlobPropertyBag.create(mimeType));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:ImageFileExport.java

示例7: doSend

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
@Override
public void doSend(byte[] data) {
    if (isClosed) {
        return;
    }
    Uint8Array push = TypedArrays.createUint8Array(data.length);
    for (int i = 0; i < data.length; i++) {
        push.set(i, data[i]);
    }
    send(push);
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:12,代码来源:WebSocketConnection.java

示例8: convertArray

import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private Uint8Array convertArray(byte[] bytes) {
	Uint8Array result = TypedArrays.createUint8Array(bytes.length);
	for (int i = 0; i < bytes.length; i++)
		result.set(i, bytes[i]);
	return result;
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:7,代码来源:DjVuText.java


注:本文中的com.google.gwt.typedarrays.shared.Uint8Array.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。