Package 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.StringBlob
-
- All Implemented Interfaces:
Serializable
,Blob
- Direct Known Subclasses:
JSONBlob
public class StringBlob extends AbstractBlob implements Serializable
Blob based on a string.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
string
-
Fields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
digest, digestAlgorithm, encoding, filename, mimeType, TEXT_PLAIN, UTF_8
-
-
Constructor Summary
Constructors Constructor Description StringBlob(String content)
StringBlob(String string, String mimeType)
StringBlob(String string, String mimeType, String encoding)
StringBlob(String string, String mimeType, String encoding, String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getByteArray()
long
getLength()
Gets the data length in bytes if known.InputStream
getStream()
Gets anInputStream
for the data of this blob.String
getString()
-
Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
equals, equalsStream, getCloseableFile, getCloseableFile, getDigest, getDigestAlgorithm, getEncoding, getFile, getFilename, getMimeType, hashCode, setDigest, setDigestAlgorithm, setEncoding, setFilename, setMimeType, transferTo, transferTo
-
-
-
-
Field Detail
-
string
protected final String string
-
-
Constructor Detail
-
StringBlob
public StringBlob(String content)
-
-
Method Detail
-
getLength
public long getLength()
Description copied from interface:Blob
Gets the data length in bytes if known.- Specified by:
getLength
in interfaceBlob
- Overrides:
getLength
in classAbstractBlob
- Returns:
- the data length or -1 if not known
-
getStream
public InputStream getStream() throws IOException
Description copied from interface:Blob
Gets anInputStream
for the data of this blob.The contract of
Blob
is that this method can be called several times and will correctly return a newInputStream
each time. In other words, several reads of theBlob
can be done.Like all
InputStream
, the result must be closed when done with it to avoid resource leaks.- Specified by:
getStream
in interfaceBlob
- Returns:
- the stream
- Throws:
IOException
-
getByteArray
public byte[] getByteArray() throws IOException
- Specified by:
getByteArray
in interfaceBlob
- Overrides:
getByteArray
in classAbstractBlob
- Throws:
IOException
-
getString
public String getString()
- Specified by:
getString
in interfaceBlob
- Overrides:
getString
in classAbstractBlob
-
-