@JsOverlay public static BlobPropertyBag createPlainTextType() { return create(PLAIN_TEXT_UTF8); }
@JsOverlay public static BlobPropertyBag create(final String type) { final BlobPropertyBag blobPropertyBag = new BlobPropertyBag(); blobPropertyBag.setType(type); return blobPropertyBag; }
/** * Factory method which creates a blob from plain string data. * @param text The plain string text encoded as UFT-8. * @return The blob instance. */ @JsOverlay public static BlobImpl create(final String text) { return new BlobImpl(new String[]{text}, BlobPropertyBag.createPlainTextType()); }
/** * Factory method which creates a blob from plain string data. * @param text The plain string text encoded as UFT-8. * @return The blob instance. */ @JsOverlay public static BlobImpl create(final String text) { return new BlobImpl(new String[]{text}, BlobPropertyBag.createPlainTextType()); }
@JsOverlay public static BlobPropertyBag createPlainTextType() { return create(PLAIN_TEXT_UTF8); }
@JsOverlay public static BlobPropertyBag create(final String type) { final BlobPropertyBag blobPropertyBag = new BlobPropertyBag(); blobPropertyBag.setType(type); return blobPropertyBag; }
@JsOverlay public static BlobPropertyBag createImagePngType() { return create(IMAGE_PNG); }
@JsOverlay public static BlobPropertyBag createImageJpgType() { return create(IMAGE_JPG); }
@JsOverlay public static BlobPropertyBag createImageJpgType() { return create(IMAGE_JPG); }
@JsOverlay public static BlobPropertyBag createImagePngType() { return create(IMAGE_PNG); }
/** * 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)); } }
/** * 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)); } }