Package org.apache.any23.source
Class ByteArrayDocumentSource
- java.lang.Object
-
- org.apache.any23.source.ByteArrayDocumentSource
-
- All Implemented Interfaces:
DocumentSource
public class ByteArrayDocumentSource extends Object implements DocumentSource
ByteArray implementation ofDocumentSource.- Author:
- Richard Cyganiak (richard@cyganiak.de)
-
-
Constructor Summary
Constructors Constructor Description ByteArrayDocumentSource(byte[] bytes, String documentIRI, String contentType)ByteArrayDocumentSource(InputStream inputStream, String documentIRI, String contentType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetContentLength()StringgetContentType()StringgetDocumentIRI()booleanisLocal()A value of false indicates that the document resides remotely, and that multiple successive accesses to it should be avoided by copying it to local storage.InputStreamopenInputStream()Returns the input stream for accessing the content of the document.
-
-
-
Constructor Detail
-
ByteArrayDocumentSource
public ByteArrayDocumentSource(byte[] bytes, String documentIRI, String contentType)
-
ByteArrayDocumentSource
public ByteArrayDocumentSource(InputStream inputStream, String documentIRI, String contentType) throws IOException
- Throws:
IOException
-
-
Method Detail
-
openInputStream
public InputStream openInputStream() throws IOException
Description copied from interface:DocumentSourceReturns the input stream for accessing the content of the document.- Specified by:
openInputStreamin interfaceDocumentSource- Returns:
- not
nullinput stream for accessing document data. - Throws:
IOException- if there is an error opening theDocumentSourceInputStream
-
getContentLength
public long getContentLength()
- Specified by:
getContentLengthin interfaceDocumentSource- Returns:
- the size of the content length in bytes.
-
getDocumentIRI
public String getDocumentIRI()
- Specified by:
getDocumentIRIin interfaceDocumentSource- Returns:
- the actual, final, canonical IRI if redirects occur.
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceDocumentSource- Returns:
- a string describing the content type of the provided document.
-
isLocal
public boolean isLocal()
Description copied from interface:DocumentSourceA value of false indicates that the document resides remotely, and that multiple successive accesses to it should be avoided by copying it to local storage. This can also be used for sources that do not support multiple calls toDocumentSource.openInputStream().- Specified by:
isLocalin interfaceDocumentSource- Returns:
- true if the
DocumentSourceis cached locally.
-
-