com.armatiek.infofuze.stream.filesystem.webcrawl
Class HTTPFile

java.lang.Object
  extended by com.armatiek.infofuze.stream.filesystem.AbstractFile
      extended by com.armatiek.infofuze.stream.filesystem.webcrawl.HTTPFile
All Implemented Interfaces:
FileIf

public class HTTPFile
extends AbstractFile

Class representing a file that can be retrieved using the HTTP.

Author:
Maarten Kroon

Constructor Summary
HTTPFile(org.apache.commons.httpclient.HttpClient httpClient, java.lang.String uri, int depth, CrawlState crawlState)
           
 
Method Summary
 java.lang.String getCharacterEncoding()
          Returns the name of the character encoding (MIME charset) of the character contents of this file.
 CrawlState getCrawlState()
           
 java.io.InputStream getInputStream()
          Returns the contents of the file as a byte stream.
 java.lang.String getMimeType()
          Returns the mime type/content type of the contents of the file.
 java.lang.String getName()
          Returns the name of the file.
 java.lang.String getParent()
          Returns the path of the parent of the file.
 FileIf getParentFile()
          Returns the parent of the file.
 java.lang.String getPath()
          Returns the path of the file.
 boolean hasContent()
          Tests whether this file has content.
 boolean isDirectory()
          Tests whether the file denoted by this abstract pathname is a directory.
 boolean isFile()
          Tests whether this file is a normal file.
 long lastModified()
          Returns the time that this file was last modified.
 long length()
          Returns the length of this file.
 java.util.Iterator<FileIf> listFiles()
          Returns an iterator of files and directories in the directory denoted by this file.
 
Methods inherited from class com.armatiek.infofuze.stream.filesystem.AbstractFile
canRead, exists, isHidden
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.armatiek.infofuze.stream.filesystem.FileIf
equals
 

Constructor Detail

HTTPFile

public HTTPFile(org.apache.commons.httpclient.HttpClient httpClient,
                java.lang.String uri,
                int depth,
                CrawlState crawlState)
Method Detail

getCrawlState

public CrawlState getCrawlState()

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: FileIf
Returns the contents of the file as a byte stream.

Returns:
an InputStream providing the contents of the file as a stream of bytes.
Throws:
java.io.IOException

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Description copied from interface: FileIf
Returns the name of the character encoding (MIME charset) of the character contents of this file. See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt) for more information about character encoding and MIME.

Specified by:
getCharacterEncoding in interface FileIf
Overrides:
getCharacterEncoding in class AbstractFile
Returns:
a String specifying the name of the character encoding, for example, UTF-8

getMimeType

public java.lang.String getMimeType()
Description copied from interface: FileIf
Returns the mime type/content type of the contents of the file.

Specified by:
getMimeType in interface FileIf
Overrides:
getMimeType in class AbstractFile
Returns:
a String specifying the mime type, for example, text/html

getName

public java.lang.String getName()
Description copied from interface: FileIf
Returns the name of the file.

Returns:
a String specifying the name of the file.

getParent

public java.lang.String getParent()
Description copied from interface: FileIf
Returns the path of the parent of the file. This is just the last name in the pathname's name sequence.

Returns:
a String specifying the path of the file's parent

getParentFile

public FileIf getParentFile()
Description copied from interface: FileIf
Returns the parent of the file.

Returns:
the FileIf interface of this file's parent

getPath

public java.lang.String getPath()
Description copied from interface: FileIf
Returns the path of the file.

Returns:
a String specifying the path of this file

hasContent

public boolean hasContent()
Description copied from interface: FileIf
Tests whether this file has content.

Specified by:
hasContent in interface FileIf
Overrides:
hasContent in class AbstractFile
Returns:
true if this file has content.

isDirectory

public boolean isDirectory()
Description copied from interface: FileIf
Tests whether the file denoted by this abstract pathname is a directory.

Returns:
true if and only if this file exists and is a directory; false otherwise

isFile

public boolean isFile()
Description copied from interface: FileIf
Tests whether this file is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria.

Returns:
true if and only if this file is a directory; false otherwise

lastModified

public long lastModified()
Description copied from interface: FileIf
Returns the time that this file was last modified.

Returns:
A long value representing the time this file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs

length

public long length()
Description copied from interface: FileIf
Returns the length of this file. The return value is unspecified if this pathname denotes a directory.

Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist.

listFiles

public java.util.Iterator<FileIf> listFiles()
Description copied from interface: FileIf
Returns an iterator of files and directories in the directory denoted by this file. If this file does not denote a directory, then this method returns null. Otherwise an iterator of files is returned, one for each file or directory in the directory. Files denoting the directory itself and the directory's parent directory are not included in the result.

Specified by:
listFiles in interface FileIf
Overrides:
listFiles in class AbstractFile
Returns:
An iterator of FileIf interfaces of the files and directories in the directory denoted by this file. The iterator will be empty if the directory is empty. Returns null if this file does not denote a directory, or if an I/O error occurs.