public class Blob extends HtmlUnitScriptable
Blob
.Modifier and Type | Class and Description |
---|---|
protected static class |
Blob.Backend
The backend used for saving the blob.
|
protected static class |
Blob.InMemoryBackend
Implementation of the
Blob.Backend that stores the bytes in memory. |
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
Blob()
Creates an instance.
|
Blob(byte[] bytes,
String contentType)
Ctor.
|
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChangeForSlot, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, 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, getSuperProperty, getSuperProperty, getSuperProperty, 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, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
createSlotMap
public Blob()
public Blob(byte[] bytes, String contentType)
bytes
- the bytescontentType
- the content typeprotected static String extractFileTypeOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
protected static long extractLastModifiedOrDefault(org.htmlunit.corejs.javascript.ScriptableObject properties)
public void jsConstructor(org.htmlunit.corejs.javascript.NativeArray fileBits, org.htmlunit.corejs.javascript.ScriptableObject properties)
fileBits
- the bitsproperties
- the propertiespublic long getSize()
size
property.size
propertypublic String getType()
type
property.type
propertypublic org.htmlunit.corejs.javascript.NativePromise arrayBuffer()
public Blob slice(Object start, Object end, Object contentType)
start
- An index into the Blob indicating the first byte to include in the new Blob. If you specify
a negative value, it's treated as an offset from the end of the Blob toward the beginning.
For example, -10 would be the 10th from last byte in the Blob. The default value is 0.
If you specify a value for start that is larger than the size of the source Blob,
the returned Blob has size 0 and contains no data.end
- An index into the Blob indicating the first byte that will not be included in the
new Blob (i.e. the byte exactly at this index is not included). If you specify a negative value,
it's treated as an offset from the end of the Blob toward the beginning.
For example, -10 would be the 10th from last byte in the Blob. The default value is size.contentType
- The content type to assign to the new Blob; this will be the value of its type property. The default value is an empty string.public ReadableStream stream()
public org.htmlunit.corejs.javascript.NativePromise text()
public byte[] getBytes()
public void fillRequest(WebRequest webRequest)
FormData
.webRequest
- the web request to fillpublic KeyDataPair getKeyDataPair(String name, String fileName)
name
- the namefileName
- the filenameKeyDataPair
protected Blob.Backend getBackend()
protected void setBackend(Blob.Backend backend)
Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.