org.nuxeo.ecm.core.api.impl.blob
Class StringBlob
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.StringBlob
- All Implemented Interfaces:
- Serializable, Blob
public class StringBlob
- extends DefaultBlob
- implements Serializable
- Author:
- Bogdan Stefanescu
- See Also:
- Serialized Form
StringBlob
public StringBlob(String content)
StringBlob
public StringBlob(String content,
String mimeType)
StringBlob
public StringBlob(String content,
String mimeType,
String encoding)
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
getStream
public InputStream getStream()
throws IOException
- Specified by:
getStream
in interface Blob
- Throws:
IOException
getByteArray
public byte[] getByteArray()
throws IOException
- Specified by:
getByteArray
in interface Blob
- Throws:
IOException
getString
public String getString()
throws IOException
- Specified by:
getString
in interface Blob
- Throws:
IOException
getReader
public Reader getReader()
throws IOException
- Specified by:
getReader
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
persist
public Blob persist()
throws IOException
- Description copied from interface:
Blob
- Persist this stream so that
Blob.getStream()
method can be called
successfully several times. The persistence is done in a temporary file
or in memory - this is up to the implementation.
Blobs that are already persistent return themselves.
Persistence should update the internal structure of the Blob to make it
persistent whenever possible and hence return itself whenever possible.
This behavior cannot be guaranteed by every implementation however.
- Specified by:
persist
in interface Blob
- Returns:
- a persistent version of the blob
- Throws:
IOException
Copyright © 2011 Nuxeo SAS. All Rights Reserved.