Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql
Class LazyBinary

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.Binary
      extended by org.nuxeo.ecm.core.storage.sql.LazyBinary
All Implemented Interfaces:
Serializable

public abstract class LazyBinary
extends Binary

Base class for a lazy Binary that fetches its remote stream on first access.

The methods fetchFile(java.io.File) and fetchLength() must be implemented by the concrete class.

See Also:
Serialized Form

Constructor Summary
LazyBinary(String digest, FileCache fileCache)
          A lazy binary for the given digest.
 
Method Summary
 long getLength()
          Gets the length of the binary.
 InputStream getStream()
          Gets an input stream for the binary.
 
Methods inherited from class org.nuxeo.ecm.core.storage.sql.Binary
getDigest, getStreamSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LazyBinary

public LazyBinary(String digest,
                  FileCache fileCache)
A lazy binary for the given digest.

Parameters:
digest - the digest for the binary
fileCache - a file cache used by the length-caching methods
Method Detail

getStream

public InputStream getStream()
                      throws IOException
Description copied from class: Binary
Gets an input stream for the binary.

Overrides:
getStream in class Binary
Returns:
the input stream
Throws:
IOException

getLength

public long getLength()
Description copied from class: Binary
Gets the length of the binary.

Overrides:
getLength in class Binary
Returns:
the length of the binary

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.