ModeShape Distribution 3.1.0.Final

org.modeshape.jcr.value.binary
Class UrlBinaryValue

java.lang.Object
  extended by org.modeshape.jcr.value.binary.AbstractBinary
      extended by org.modeshape.jcr.value.binary.UrlBinaryValue
All Implemented Interfaces:
Serializable, Comparable<BinaryValue>, Binary, BinaryValue

public class UrlBinaryValue
extends AbstractBinary

A BinaryValue implementation used to read the content of a resolvable URL. This class computes the MIME type lazily.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.modeshape.jcr.value.binary.AbstractBinary
EMPTY_CONTENT
 
Constructor Summary
UrlBinaryValue(BinaryKey binaryKey, URL content, long size, String nameHint, MimeTypeDetector mimeTypeDetector)
           
 
Method Summary
 String getMimeType()
           
 String getMimeType(String name)
           
 long getSize()
          Get the length of this binary data.
 InputStream getStream()
           
protected  boolean hasMimeType()
           
protected  void setMimeType(String mimeType)
           
protected  URL toUrl()
           
 
Methods inherited from class org.modeshape.jcr.value.binary.AbstractBinary
compareTo, dispose, equals, getHash, getHexHash, getKey, getReadableSize, hashCode, keyFor, read, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UrlBinaryValue

public UrlBinaryValue(BinaryKey binaryKey,
                      URL content,
                      long size,
                      String nameHint,
                      MimeTypeDetector mimeTypeDetector)
Method Detail

toUrl

protected URL toUrl()

setMimeType

protected void setMimeType(String mimeType)

hasMimeType

protected boolean hasMimeType()

getMimeType

public String getMimeType()

getMimeType

public String getMimeType(String name)

getSize

public long getSize()
Description copied from interface: BinaryValue
Get the length of this binary data.

Note that this method, unlike the standard Binary.getSize() method, does not throw an exception.

Returns:
the number of bytes in this binary data

getStream

public InputStream getStream()
                      throws RepositoryException
Throws:
RepositoryException

ModeShape Distribution 3.1.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.