Class URLBlob

java.lang.Object
org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
org.nuxeo.ecm.core.api.impl.blob.URLBlob
All Implemented Interfaces:
Serializable, Blob

public class URLBlob extends AbstractBlob implements Serializable
Blob backed by a URL. Note that the encoding is not detected even for an HTTP URL.
See Also:
  • Field Details

    • url

      protected final URL url
    • length

      protected volatile Long length
  • Constructor Details

    • URLBlob

      public URLBlob(URL url)
    • URLBlob

      public URLBlob(URL url, String mimeType)
    • URLBlob

      public URLBlob(URL url, String mimeType, String encoding)
  • Method Details

    • getStream

      public InputStream getStream() throws IOException
      Description copied from interface: Blob
      Gets an InputStream for the data of this blob.

      The contract of Blob is that this method can be called several times and will correctly return a new InputStream each time. In other words, several reads of the Blob can be done.

      Like all InputStream, the result must be closed when done with it to avoid resource leaks.

      Specified by:
      getStream in interface Blob
      Returns:
      the stream
      Throws:
      IOException
    • getLength

      public long getLength()
      Description copied from interface: Blob
      Gets the data length in bytes if known.
      Specified by:
      getLength in interface Blob
      Overrides:
      getLength in class AbstractBlob
      Returns:
      the data length or -1 if not known