org.nuxeo.ecm.core.api.impl.blob
Class StreamingBlob
java.lang.Object
org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
org.nuxeo.ecm.core.api.impl.blob.DefaultBlob
org.nuxeo.ecm.core.api.impl.blob.StreamingBlob
- All Implemented Interfaces:
- Serializable, Blob
public class StreamingBlob
- extends DefaultBlob
- implements Serializable
- Author:
- Bogdan Stefanescu
- See Also:
- Serialized Form
MEM_MAX_LIMIT
public static final int MEM_MAX_LIMIT
- See Also:
- Constant Field Values
StreamingBlob
public StreamingBlob(StreamSource src)
StreamingBlob
public StreamingBlob(StreamSource src,
String mimeType)
StreamingBlob
public StreamingBlob(StreamSource src,
String mimeType,
String encoding)
StreamingBlob
public StreamingBlob(StreamSource src,
String mimeType,
String encoding,
String filename,
String digest)
createFromStream
public static StreamingBlob createFromStream(InputStream is)
createFromStream
public static StreamingBlob createFromStream(InputStream is,
String mimeType)
createFromByteArray
public static StreamingBlob createFromByteArray(byte[] bytes)
createFromByteArray
public static StreamingBlob createFromByteArray(byte[] bytes,
String mimeType)
createFromString
public static StreamingBlob createFromString(String str)
createFromString
public static StreamingBlob createFromString(String str,
String mimeType)
createFromFile
public static StreamingBlob createFromFile(File file)
createFromFile
public static StreamingBlob createFromFile(File file,
String mimeType)
createFromURL
public static StreamingBlob createFromURL(URL url)
createFromURL
public static StreamingBlob createFromURL(URL url,
String mimeType)
getByteArray
public byte[] getByteArray()
throws IOException
- Specified by:
getByteArray
in interface Blob
- Throws:
IOException
getLength
public long getLength()
- Description copied from interface:
Blob
- Gets the data length in bytes if known.
- Specified by:
getLength
in interface Blob
- Returns:
- the data length or -1 if not known
getReader
public Reader getReader()
throws IOException
- Specified by:
getReader
in interface Blob
- Throws:
IOException
getStream
public InputStream getStream()
throws IOException
- Specified by:
getStream
in interface Blob
- Throws:
IOException
getString
public String getString()
throws IOException
- Specified by:
getString
in interface Blob
- Throws:
IOException
isPersistent
public boolean isPersistent()
- Description copied from interface:
Blob
- Checks whether this blob is persistent. (i.e. if
Blob.getStream()
can be
successfully called several times).
- Specified by:
isPersistent
in interface Blob
- Returns:
- true if persistent, false otherwise
getStreamSource
public StreamSource getStreamSource()
persist
public Blob persist()
throws IOException
- If the source is cannot be reopen, copy the binary content of the
original source to a temporary file and replace the source inplace by a
new FileSource instance pointing to the tmp file.
return the current instance with a re-openable internal source
- Specified by:
persist
in interface Blob
- Returns:
- a persistent version of the blob
- Throws:
IOException
Copyright © 2011 Nuxeo SAS. All Rights Reserved.