Package org.nuxeo.ecm.core.api.impl.blob
Class AbstractBlob
- java.lang.Object
-
- org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
-
- All Implemented Interfaces:
Serializable
,Blob
- Direct Known Subclasses:
BinaryBlob
,ByteArrayBlob
,FileBlob
,SimpleManagedBlob
,StringBlob
,URLBlob
,ZipEntryBlob
public abstract class AbstractBlob extends Object implements Blob, Serializable
Abstract implementation of aBlob
storing the information other than the byte stream.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractBlob()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
protected boolean
equalsStream(Blob other)
byte[]
getByteArray()
CloseableFile
getCloseableFile()
Gets aCloseableFile
backing this blob, which must be closed when done by the caller.CloseableFile
getCloseableFile(String ext)
Gets aCloseableFile
backing this blob, which must be closed when done by the caller.String
getDigest()
String
getDigestAlgorithm()
String
getEncoding()
File
getFile()
If this blob is backed by an actual file, returns it.String
getFilename()
long
getLength()
Gets the data length in bytes if known.String
getMimeType()
String
getString()
int
hashCode()
void
setDigest(String digest)
void
setDigestAlgorithm(String digestAlgorithm)
void
setEncoding(String encoding)
void
setFilename(String filename)
void
setMimeType(String mimeType)
void
transferTo(File file)
void
transferTo(OutputStream out)
-
-
-
Field Detail
-
UTF_8
public static final String UTF_8
- See Also:
- Constant Field Values
-
TEXT_PLAIN
public static final String TEXT_PLAIN
- See Also:
- Constant Field Values
-
mimeType
protected String mimeType
-
encoding
protected String encoding
-
filename
protected String filename
-
digest
protected String digest
-
digestAlgorithm
protected String digestAlgorithm
-
-
Method Detail
-
getMimeType
public String getMimeType()
- Specified by:
getMimeType
in interfaceBlob
-
getEncoding
public String getEncoding()
- Specified by:
getEncoding
in interfaceBlob
-
getFilename
public String getFilename()
- Specified by:
getFilename
in interfaceBlob
-
getDigestAlgorithm
public String getDigestAlgorithm()
- Specified by:
getDigestAlgorithm
in interfaceBlob
-
setMimeType
public void setMimeType(String mimeType)
- Specified by:
setMimeType
in interfaceBlob
-
setEncoding
public void setEncoding(String encoding)
- Specified by:
setEncoding
in interfaceBlob
-
setFilename
public void setFilename(String filename)
- Specified by:
setFilename
in interfaceBlob
-
setDigestAlgorithm
public void setDigestAlgorithm(String digestAlgorithm)
- Specified by:
setDigestAlgorithm
in interfaceBlob
-
getFile
public File getFile()
Description copied from interface:Blob
If this blob is backed by an actual file, returns it.The returned file may be short-lived (temporary), so should be used immediately.
-
getByteArray
public byte[] getByteArray() throws IOException
- Specified by:
getByteArray
in interfaceBlob
- Throws:
IOException
-
getString
public String getString() throws IOException
- Specified by:
getString
in interfaceBlob
- Throws:
IOException
-
getLength
public long getLength()
Description copied from interface:Blob
Gets the data length in bytes if known.
-
getCloseableFile
public CloseableFile getCloseableFile() throws IOException
Description copied from interface:Blob
Gets aCloseableFile
backing this blob, which must be closed when done by the caller.The returned file may be the original file, a temporary file, or a symbolic link.
- Specified by:
getCloseableFile
in interfaceBlob
- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-
getCloseableFile
public CloseableFile getCloseableFile(String ext) throws IOException
Description copied from interface:Blob
Gets aCloseableFile
backing this blob, which must be closed when done by the caller.The returned file may be the original file, a temporary file, or a symbolic link.
- Specified by:
getCloseableFile
in interfaceBlob
- Parameters:
ext
- the required extension for the file, ornull
if it doesn't matter- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-
transferTo
public void transferTo(OutputStream out) throws IOException
- Specified by:
transferTo
in interfaceBlob
- Throws:
IOException
-
transferTo
public void transferTo(File file) throws IOException
- Specified by:
transferTo
in interfaceBlob
- Throws:
IOException
-
equalsStream
protected boolean equalsStream(Blob other)
-
-