org.d2rq.download
Class DownloadContentQuery

java.lang.Object
  extended by org.d2rq.download.DownloadContentQuery

public class DownloadContentQuery
extends Object

A helper that evaluates a DownloadRelation for a particular URI, returning either the content, or null if the URI isn't applicable for the download map or there is nothing in the table for the value. This directly runs its own SQL query because the handling of BLOBs here requires returning an InputStream, and that's not easily supported by our usual SQL query class.

Author:
RichardCyganiak

Constructor Summary
DownloadContentQuery(DownloadRelation downloadRelation, String uri)
           
 
Method Summary
 void close()
           
 InputStream getContentStream()
          A stream over the downloadable content.
 String getMediaType()
          The media type of the downloadable content.
 boolean hasContent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadContentQuery

public DownloadContentQuery(DownloadRelation downloadRelation,
                            String uri)
Parameters:
downloadRelation - The download map to be queried
uri - The URI whose content is desired
Method Detail

hasContent

public boolean hasContent()

getContentStream

public InputStream getContentStream()
A stream over the downloadable content. Undefined if hasContent() is false.


getMediaType

public String getMediaType()
The media type of the downloadable content. Undefined if hasContent() is false.


close

public void close()