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:
- java.io.Serializable, Blob
public class StreamingBlob
- extends DefaultBlob
- implements java.io.Serializable
- Author:
- Bogdan Stefanescu
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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,
java.lang.String mimeType)
StreamingBlob
public StreamingBlob(StreamSource src,
java.lang.String mimeType,
java.lang.String encoding)
StreamingBlob
public StreamingBlob(StreamSource src,
java.lang.String mimeType,
java.lang.String encoding,
java.lang.String filename,
java.lang.String digest)
createFromStream
public static StreamingBlob createFromStream(java.io.InputStream is)
createFromStream
public static StreamingBlob createFromStream(java.io.InputStream is,
java.lang.String mimeType)
createFromByteArray
public static StreamingBlob createFromByteArray(byte[] bytes)
createFromByteArray
public static StreamingBlob createFromByteArray(byte[] bytes,
java.lang.String mimeType)
createFromString
public static StreamingBlob createFromString(java.lang.String str)
createFromString
public static StreamingBlob createFromString(java.lang.String str,
java.lang.String mimeType)
createFromFile
public static StreamingBlob createFromFile(java.io.File file)
createFromFile
public static StreamingBlob createFromFile(java.io.File file,
java.lang.String mimeType)
createFromURL
public static StreamingBlob createFromURL(java.net.URL url)
createFromURL
public static StreamingBlob createFromURL(java.net.URL url,
java.lang.String mimeType)
getByteArray
public byte[] getByteArray()
throws java.io.IOException
- Specified by:
getByteArray
in interface Blob
- Throws:
java.io.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 java.io.Reader getReader()
throws java.io.IOException
- Specified by:
getReader
in interface Blob
- Throws:
java.io.IOException
getStream
public java.io.InputStream getStream()
throws java.io.IOException
- Specified by:
getStream
in interface Blob
- Throws:
java.io.IOException
getString
public java.lang.String getString()
throws java.io.IOException
- Specified by:
getString
in interface Blob
- Throws:
java.io.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 java.io.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:
java.io.IOException
Copyright © 2010 Nuxeo SAS. All Rights Reserved.