java.lang.Object
org.htmlunit.javascript.host.file.Blob.InMemoryBackend
- All Implemented Interfaces:
Serializable,Blob.Backend
- Enclosing class:
- Blob
Implementation of the
Blob.Backend that stores the bytes in memory.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInMemoryBackend(byte[] bytes, String fileName, String type, long lastModified) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static Blob.InMemoryBackendcreate(org.htmlunit.corejs.javascript.NativeArray fileBits, String fileName, String type, long lastModified) Factory method to create anBlob.InMemoryBackendfrom anNativeArray.byte[]getBytes(int start, int end) Returns the bytes.getKeyDataPair(String name, String fileName, String contentType) Returns the KeyDataPair for this Blob/File.longReturns the last modified timestamp as long.getName()Returns the name.longgetSize()Returns the size.getText()Returns the text.getType(BrowserVersion browserVersion) Returns the type.
-
Constructor Details
-
InMemoryBackend
Ctor.- Parameters:
bytes- the bytesfileName- the nametype- the typelastModified- last modified
-
-
Method Details
-
create
protected static Blob.InMemoryBackend create(org.htmlunit.corejs.javascript.NativeArray fileBits, String fileName, String type, long lastModified) Factory method to create anBlob.InMemoryBackendfrom anNativeArray.- Parameters:
fileBits- the bytes asNativeArrayfileName- the nametype- the typelastModified- last modified- Returns:
- the new
Blob.InMemoryBackend
-
getName
Returns the name.- Specified by:
getNamein interfaceBlob.Backend- Returns:
- the name
-
getLastModified
public long getLastModified()Returns the last modified timestamp as long.- Specified by:
getLastModifiedin interfaceBlob.Backend- Returns:
- the last modified timestamp as long
-
getSize
public long getSize()Returns the size.- Specified by:
getSizein interfaceBlob.Backend- Returns:
- the size
-
getType
Returns the type.- Specified by:
getTypein interfaceBlob.Backend- Parameters:
browserVersion- theBrowserVersion- Returns:
- the type
-
getText
Returns the text.- Specified by:
getTextin interfaceBlob.Backend- Returns:
- the text
- Throws:
IOException- in case of error
-
getBytes
public byte[] getBytes(int start, int end) Returns the bytes.- Specified by:
getBytesin interfaceBlob.Backend- Parameters:
start- the start positionend- the end position- Returns:
- the bytes
-
getKeyDataPair
Returns the KeyDataPair for this Blob/File.- Specified by:
getKeyDataPairin interfaceBlob.Backend- Parameters:
name- the namefileName- the file namecontentType- the content type- Returns:
- the KeyDataPair to hold the data
-