Class Blob
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.file.Blob
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,org.htmlunit.corejs.javascript.ConstProperties
,org.htmlunit.corejs.javascript.debug.DebuggableObject
,org.htmlunit.corejs.javascript.Scriptable
,org.htmlunit.corejs.javascript.SymbolScriptable
- Direct Known Subclasses:
File
public class Blob extends HtmlUnitScriptable
A JavaScript object forBlob
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Blob.Backend
protected static class
Blob.InMemoryBackend
-
Field Summary
Fields Modifier and Type Field Description private Blob.Backend
backend_
private static java.lang.String
OPTIONS_LASTMODIFIED
private static java.lang.String
OPTIONS_TYPE_DEFAULT
private static java.lang.String
OPTIONS_TYPE_NAME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
arrayBuffer()
protected static java.lang.String
extractFileTypeOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
protected static long
extractLastModifiedOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
void
fillRequest(WebRequest webRequest)
Sets the specified request with the parameters in thisFormData
.protected Blob.Backend
getBackend()
byte[]
getBytes()
long
getSize()
Returns thesize
property.java.lang.String
getType()
Returns thetype
property.void
jsConstructor(org.htmlunit.corejs.javascript.NativeArray fileBits, org.htmlunit.corejs.javascript.ScriptableObject properties)
Creates an instance.protected void
setBackend(Blob.Backend backend)
Blob
slice(java.lang.Object start, java.lang.Object end, java.lang.Object contentType)
ReadableStream
stream()
java.lang.Object
text()
-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
-
-
-
Field Detail
-
OPTIONS_TYPE_NAME
private static final java.lang.String OPTIONS_TYPE_NAME
- See Also:
- Constant Field Values
-
OPTIONS_TYPE_DEFAULT
private static final java.lang.String OPTIONS_TYPE_DEFAULT
- See Also:
- Constant Field Values
-
OPTIONS_LASTMODIFIED
private static final java.lang.String OPTIONS_LASTMODIFIED
- See Also:
- Constant Field Values
-
backend_
private Blob.Backend backend_
-
-
Method Detail
-
extractFileTypeOrDefault
protected static java.lang.String extractFileTypeOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
-
extractLastModifiedOrDefault
protected static long extractLastModifiedOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
-
jsConstructor
public void jsConstructor(org.htmlunit.corejs.javascript.NativeArray fileBits, org.htmlunit.corejs.javascript.ScriptableObject properties)
Creates an instance.- Parameters:
fileBits
- the bitsproperties
- the properties
-
getSize
public long getSize()
Returns thesize
property.- Returns:
- the
size
property
-
getType
public java.lang.String getType()
Returns thetype
property.- Returns:
- the
type
property
-
arrayBuffer
public java.lang.Object arrayBuffer()
- Returns:
- a Promise that resolves with an ArrayBuffer containing the data in binary form.
-
slice
public Blob slice(java.lang.Object start, java.lang.Object end, java.lang.Object contentType)
-
stream
public ReadableStream stream()
-
text
public java.lang.Object text()
- Returns:
- a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.
-
getBytes
public byte[] getBytes()
-
fillRequest
public void fillRequest(WebRequest webRequest)
Sets the specified request with the parameters in thisFormData
.- Parameters:
webRequest
- the web request to fill
-
getBackend
protected Blob.Backend getBackend()
-
setBackend
protected void setBackend(Blob.Backend backend)
-
-