com.languagecomputer.api
Interface DocumentService

All Superinterfaces:
Service
All Known Implementing Classes:
DocumentServiceWebClient

public interface DocumentService
extends Service

Raw document processing service. Processes a raw File, URL, URI, or InputStream and returns a document handle that acts as a unique identifier.

Provides the ability to automatically detect file types (PDF, MSWord, HTML, XML, etc) or to specify them manually. Automatic detection refers to the DocumentService's ability to identify the file type of the source and strip out all mark up, turning it into a String. Using automatic detection is recommended. The following is a list of document types which must be provided:

Additionally, implmentations may include support for other file types as necessary.

Since:
1.0
Author:
Kirk Roberts
See Also:
Document

Method Summary
 Document process(File file)
          Processes the given File, placing the processed contents into the returned Document.
 Document process(File file, String fileType)
          Processes the given File, placing the processed contents into the returned Document.
 Document process(InputStream stream)
          Processes the given InputStream, placing the processed contents into the returned Document.
 Document process(InputStream stream, String fileType)
          Processes the given InputStream, placing the processed contents into the returned Document.
 Document process(URI uri)
          Processes the given URI, placing the processed contents into the returned Document.
 Document process(URI uri, String fileType)
          Processes the given URI, placing the processed contents into the returned Document.
 Document process(URL url)
          Processes the given URL, placing the processed contents into the returned Document.
 Document process(URL url, String fileType)
          Processes the given URL, placing the processed contents into the returned Document.
 
Methods inherited from interface com.languagecomputer.api.Service
getName, setSession
 

Method Detail

process

Document process(URL url)
                 throws IOException
Processes the given URL, placing the processed contents into the returned Document. Automatically detects the file type.

Parameters:
url - java.net.URL of the file to process.
Returns:
A processed Document corresponding to the given url.
Throws:
IOException - If there was a problem reading the URL.

process

Document process(URL url,
                 String fileType)
                 throws IOException
Processes the given URL, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Parameters:
url - java.net.URL of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given url.
Throws:
IllegalArgumentException - If the given fileType is not one of the valid file types specified in the DocumentService.
IOException - If there was a problem reading the URL.

process

Document process(URI uri)
                 throws IOException
Processes the given URI, placing the processed contents into the returned Document. Automatically detects the file type.

Parameters:
uri - java.net.URI of the file to process.
Returns:
A processed Document corresponding to the given uri.
Throws:
IOException - If there was a problem reading the URI.

process

Document process(URI uri,
                 String fileType)
                 throws IOException
Processes the given URI, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Parameters:
uri - java.net.URI of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given uri.
Throws:
IllegalArgumentException - If the given fileType is not one of the valid file types specified in the DocumentService.
IOException - If there was a problem reading the URI.

process

Document process(File file)
                 throws IOException
Processes the given File, placing the processed contents into the returned Document. Automatically detects the file type.

Parameters:
file - java.io.File of the file to process.
Returns:
A processed Document corresponding to the given file.
Throws:
IOException - If there was a problem reading the File.

process

Document process(File file,
                 String fileType)
                 throws IOException
Processes the given File, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Parameters:
file - java.io.File of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given file.
Throws:
IllegalArgumentException - If the given fileType is not one of the valid file types specified in the DocumentService.
IOException - If there was a problem reading the File.

process

Document process(InputStream stream)
                 throws IOException
Processes the given InputStream, placing the processed contents into the returned Document. Automatically detects the file type.

Parameters:
stream - java.io.InputStream of the file to process.
Returns:
A processed Document corresponding to the given stream.
Throws:
IOException - If there was a problem reading the InputStream.

process

Document process(InputStream stream,
                 String fileType)
                 throws IOException
Processes the given InputStream, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Parameters:
stream - java.io.InputStream of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given stream.
Throws:
IllegalArgumentException - If the given fileType is not one of the valid file types specified in the DocumentService.
IOException - If there was a problem reading the InputStream.


Copyright © 2009. All Rights Reserved.