Package org.apache.any23.source
Class FileDocumentSource
- java.lang.Object
-
- org.apache.any23.source.FileDocumentSource
-
- All Implemented Interfaces:
DocumentSource
public class FileDocumentSource extends Object implements DocumentSource
File implementation ofDocumentSource
.
-
-
Constructor Summary
Constructors Constructor Description FileDocumentSource(File file)
FileDocumentSource(File file, String baseIRI)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getContentLength()
String
getContentType()
String
getDocumentIRI()
boolean
isLocal()
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.InputStream
openInputStream()
Returns the input stream for accessing the content of the document.String
readStream()
-
-
-
Method Detail
-
openInputStream
public InputStream openInputStream() throws IOException
Description copied from interface:DocumentSource
Returns the input stream for accessing the content of the document.- Specified by:
openInputStream
in interfaceDocumentSource
- Returns:
- not
null
input stream for accessing document data. - Throws:
IOException
- if there is an error opening theDocumentSource
InputStream
-
getContentLength
public long getContentLength()
- Specified by:
getContentLength
in interfaceDocumentSource
- Returns:
- the size of the content length in bytes.
-
getDocumentIRI
public String getDocumentIRI()
- Specified by:
getDocumentIRI
in interfaceDocumentSource
- Returns:
- the actual, final, canonical IRI if redirects occur.
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceDocumentSource
- Returns:
- a string describing the content type of the provided document.
-
isLocal
public boolean isLocal()
Description copied from interface:DocumentSource
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. This can also be used for sources that do not support multiple calls toDocumentSource.openInputStream()
.- Specified by:
isLocal
in interfaceDocumentSource
- Returns:
- true if the
DocumentSource
is cached locally.
-
readStream
public String readStream() throws IOException
- Throws:
IOException
-
-