-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathBlob.java
More file actions
37 lines (32 loc) · 793 Bytes
/
Blob.java
File metadata and controls
37 lines (32 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package snap.webapi;
/**
* This class is a wrapper for Web API Blob (https://developer.mozilla.org/en-US/docs/Web/API/Blob).
*/
public class Blob extends JSProxy {
/**
* Constructor.
*/
public Blob(Object jsObj)
{
super(jsObj);
}
/**
* Constructor for given bytes and type.
*/
public Blob(byte[] byteArray, String aType)
{
super(WebEnv.get().newBlobJSForBytesAndType(byteArray, aType));
}
/**
* Returns the blob text.
*/
public String getText()
{
Object promiseJS = call("text");
return (String) WebEnv.get().awaitForPromise(promiseJS);
}
/**
* Returns a URL for this blob.
*/
public String createURL() { return WebEnv.get().createUrlForBlobJS(_jsObj); }
}