Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.api.impl.blob
Class ByteArrayBlob

java.lang.Object
  extended by org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
      extended by org.nuxeo.ecm.core.api.impl.blob.DefaultBlob
          extended by org.nuxeo.ecm.core.api.impl.blob.ByteArrayBlob
All Implemented Interfaces:
java.io.Serializable, Blob

public class ByteArrayBlob
extends DefaultBlob
implements java.io.Serializable

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
EMPTY_BYTE_ARRAY, EMPTY_INPUT_STREAM, EMPTY_READER, EMPTY_STRING
 
Constructor Summary
ByteArrayBlob(byte[] content)
           
ByteArrayBlob(byte[] content, java.lang.String ctype)
           
ByteArrayBlob(byte[] content, java.lang.String ctype, java.lang.String encoding)
           
ByteArrayBlob(byte[] content, java.lang.String mimeType, java.lang.String encoding, java.lang.String filename, java.lang.String digest)
           
 
Method Summary
 byte[] getByteArray()
           
 long getLength()
          Gets the data length in bytes if known.
 java.io.Reader getReader()
           
 java.io.InputStream getStream()
           
 java.lang.String getString()
           
 boolean isPersistent()
          Checks whether this blob is persistent.
 Blob persist()
          Persist this stream so that Blob.getStream() method can be called successfully several times.
 
Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.DefaultBlob
getDigest, getEncoding, getFilename, getMimeType, setDigest, setEncoding, setFilename, setMimeType
 
Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
copy, copy, transferTo, transferTo, transferTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayBlob

public ByteArrayBlob(byte[] content)

ByteArrayBlob

public ByteArrayBlob(byte[] content,
                     java.lang.String ctype)

ByteArrayBlob

public ByteArrayBlob(byte[] content,
                     java.lang.String ctype,
                     java.lang.String encoding)

ByteArrayBlob

public ByteArrayBlob(byte[] content,
                     java.lang.String mimeType,
                     java.lang.String encoding,
                     java.lang.String filename,
                     java.lang.String digest)
Method Detail

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 java.io.InputStream getStream()
                              throws java.io.IOException
Specified by:
getStream in interface Blob
Throws:
java.io.IOException

getByteArray

public byte[] getByteArray()
                    throws java.io.IOException
Specified by:
getByteArray 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

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
Specified by:
getReader in interface Blob
Throws:
java.io.IOException

persist

public Blob persist()
             throws java.io.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:
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

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.