• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Int8Array类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gwt.typedarrays.shared.Int8Array的典型用法代码示例。如果您正苦于以下问题:Java Int8Array类的具体用法?Java Int8Array怎么用?Java Int8Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Int8Array类属于com.google.gwt.typedarrays.shared包,在下文中一共展示了Int8Array类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getBuffer

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
public ByteBuffer getBuffer () {
	if (getRows() == 0)
		// Issue #768 - CheckJNI frowns upon env->NewDirectByteBuffer with NULL buffer or capacity 0
		// "JNI WARNING: invalid values for address (0x0) or capacity (0)"
		// FreeType sets FT_Bitmap::buffer to NULL when the bitmap is empty (e.g. for ' ')
		// JNICheck is on by default on emulators and might have a point anyway...
		// So let's avoid this and just return a dummy non-null non-zero buffer
		return BufferUtils.newByteBuffer(1);
	int offset = getBufferAddress(address);
	int length = getBufferSize(address);
	Int8Array as = getBuffer(address, offset, length);
	ArrayBuffer aBuf = as.buffer();
	ByteBuffer buf = FreeTypeUtil.newDirectReadWriteByteBuffer(aBuf, length, offset);

	return buf;
}
 
开发者ID:intrigus,项目名称:gdx-freetype-gwt,代码行数:17,代码来源:FreeType.java


示例2: loadBinary

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
public void loadBinary (final String url, final AssetLoaderListener<Blob> listener) {
	XMLHttpRequest request = XMLHttpRequest.create();		
	request.setOnReadyStateChange(new ReadyStateChangeHandler() {
		@Override
		public void onReadyStateChange (XMLHttpRequest xhr) {
			if (xhr.getReadyState() == XMLHttpRequest.DONE) {
				if (xhr.getStatus() != 200) {
					listener.onFailure();
				} else {
					Int8Array data = TypedArrays.createInt8Array(xhr.getResponseArrayBuffer());
					listener.onSuccess(new Blob(data));
				}
			}
		}
	});
	setOnProgress(request, listener);
	request.open("GET", url);
	request.setResponseType(ResponseType.ArrayBuffer);
	request.send();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:21,代码来源:AssetDownloader.java


示例3: toByteArray

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的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;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:12,代码来源:GwtWebSocket.java


示例4: sendBinary

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的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);
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:12,代码来源:GwtWebSocket.java


示例5: send

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
private void send( final WebSocket webSocket, final String message, final boolean binary )
{
  if ( binary )
  {
    final Int8Array arrayBuffer = TypedArrays.createInt8Array( message.length() );
    arrayBuffer.set( message.getBytes() );
    webSocket.send( arrayBuffer );
  }
  else
  {
    webSocket.send( message );
  }
}
 
开发者ID:realityforge,项目名称:gwt-websockets-example,代码行数:14,代码来源:Example.java


示例6: onMessage

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
public void onMessage( @Nonnull final WebSocket webSocket, @Nonnull final ArrayBuffer data )
{
  logStatus( "Message", webSocket );
  final Int8Array arrayBuffer = TypedArrays.createInt8Array( data );
  final StringBuilder sb = new StringBuilder();
  for ( int i = 0; i < arrayBuffer.length(); i++ )
  {
    sb.append( (char) arrayBuffer.get( i ) );
  }
  appendText( "binary message: " + sb, "black" );
}
 
开发者ID:realityforge,项目名称:gwt-websockets-example,代码行数:12,代码来源:Example.java


示例7: Blob

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
public Blob (Int8Array data) {
	this.data = data;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:4,代码来源:Blob.java


示例8: HttpClientResponse

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
public HttpClientResponse(int status, Int8Array response, XMLHttpRequest request) {
	this.response = response;
	this.status = new HttpStatus(status);
          this.request = request;
}
 
开发者ID:neuroradiology,项目名称:TinyVoxel,代码行数:6,代码来源:GwtNet.java


示例9: sendHttpRequest

import com.google.gwt.typedarrays.shared.Int8Array; //导入依赖的package包/类
@Override
public void sendHttpRequest (final HttpRequest httpRequest, final HttpResponseListener httpResultListener) {
	if (httpRequest.getUrl() == null) {
		httpResultListener.failed(new GdxRuntimeException("can't process a HTTP request without URL set"));
		return;
	}

	final String method = httpRequest.getMethod();		
	final String value = httpRequest.getContent();
	final boolean valueInBody = method.equalsIgnoreCase(HttpMethods.POST) || method.equals(HttpMethods.PUT);

       String url = httpRequest.getUrl();
       if (method.equalsIgnoreCase(HttpMethods.GET)) {
           if (value != null) {
               url += "?" + value;
           }
       } else if (method.equalsIgnoreCase(HttpMethods.POST)) {
       } else if (method.equalsIgnoreCase(HttpMethods.DELETE)) {
           if (value != null) {
               url += "?" + value;
           }
       } else if (method.equalsIgnoreCase(HttpMethods.PUT)) {
       } else {
           throw new GdxRuntimeException("Unsupported HTTP Method");
       }

       XMLHttpRequest request = XMLHttpRequest.create();

       request.setOnReadyStateChange(new ReadyStateChangeHandler() {
           @Override
           public void onReadyStateChange(XMLHttpRequest xhr) {
               if (xhr.getReadyState() == XMLHttpRequest.DONE) {
                   if (xhr.getStatus() != 200) {
                       httpResultListener.failed(new Throwable(xhr.getStatusText()));
                       requests.remove(httpRequest);
                       listeners.remove(httpRequest);
                   } else {
                       Int8Array data = TypedArrays.createInt8Array(xhr.getResponseArrayBuffer());
                       httpResultListener.handleHttpResponse(new HttpClientResponse(xhr.getStatus(), data, xhr));
                       requests.remove(httpRequest);
                       listeners.remove(httpRequest);
                   }
               }
           }
       });
       request.open(method, url);

       Map<String, String> content = httpRequest.getHeaders();
       Set<String> keySet = content.keySet();
       for (String name : keySet) {
           request.setRequestHeader(name, content.get(name));
       }
       request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);

       if (valueInBody)
           request.send(value);
       else
           request.send();


       requests.put(httpRequest, request);
       listeners.put(httpRequest, httpResultListener);
}
 
开发者ID:neuroradiology,项目名称:TinyVoxel,代码行数:64,代码来源:GwtNet.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ObjectHistogram类代码示例发布时间:2022-05-22
下一篇:
Java HttpClient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap