All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.akjava.gwt.jszip.Uint8Array Maven / Gradle / Ivy

The newest version!
package com.akjava.gwt.jszip;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArrayInteger;
import com.google.gwt.typedarrays.client.Uint8ArrayNative;
import com.google.gwt.typedarrays.shared.ArrayBuffer;

/*
 * i can't solve this
 * com.google.gwt.dev.jjs.InternalCompilerException: Already seen an implementing JSO subtype (Uint8ArrayImpl) for interface (ArrayBufferView) while examining newly-added type (ArrayBufferViewNative). This is a bug in JSORestrictionsChecker.
 */
public class Uint8Array extends JavaScriptObject {
protected Uint8Array(){}

/**
 * should id do boule?
 * @return
 */
	public  final native int length()/*-{
    return this.length;
  }-*/;
	
	public  final native int get(int index)/*-{
    return this[index];
  }-*/;
	
	
	public  final native ArrayBuffer getBuffer()/*-{
    return this.buffer;
  }-*/;
	
	public  static final native Uint8Array createUint8(ArrayBuffer buffer)/*-{
	  var uInt8Array = new $wnd.Uint8Array(buffer);
	  return uInt8Array;
	}-*/;
	
	public  static final native Uint8Array createUint8(int length)/*-{
    var uInt8Array = new $wnd.Uint8Array(length);
	  return uInt8Array;
	}-*/;
	
	public  static final native Uint8Array createUint8(byte[] bytes)/*-{
	      var uInt8Array = new $wnd.Uint8Array(bytes);
		  return uInt8Array;
	  	}-*/;
	
	/*
	public static final Uint8Array createUint8(byte[] bytes){
		JsArrayInteger array=(JsArrayInteger) JsArrayInteger.createArray();
		for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy