org.archive.crawler.writer
Class MirrorWriterProcessor.URIToFileReturn

java.lang.Object
  extended by org.archive.crawler.writer.MirrorWriterProcessor.URIToFileReturn
Enclosing class:
MirrorWriterProcessor

 class MirrorWriterProcessor.URIToFileReturn
extends java.lang.Object

This class is returned by uriToFile. It represents a file system path, both as a File and as a path relative to the base directory.


Constructor Summary
MirrorWriterProcessor.URIToFileReturn(java.lang.String baseDir, java.lang.String host, int port)
          Creates a URIToFileReturn.
 
Method Summary
(package private)  void append(java.io.File f, java.lang.String nextSegment)
          Appends one more segment to this path.
(package private)  java.io.File getFile()
          Gets this path as a File.
(package private)  java.lang.String getRelativePath()
          Gets this path as a relative path from the base directory.
(package private)  boolean longerThan(int maxLen)
          Tests if this path is longer than a given value.
(package private)  void mkdirs()
          Creates all directories in this path as needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MirrorWriterProcessor.URIToFileReturn

MirrorWriterProcessor.URIToFileReturn(java.lang.String baseDir,
                                      java.lang.String host,
                                      int port)
Creates a URIToFileReturn.

Parameters:
baseDir - the path to the starting directory
host - the host part of the URI, or null if the host name should not be part of the path
port - the port part of the URI, or -1 if the port should not be part of the path
Method Detail

append

void append(java.io.File f,
            java.lang.String nextSegment)
Appends one more segment to this path.

Parameters:
f - a File representing the path with the next segment added
nextSegment - the next segment

getFile

java.io.File getFile()
Gets this path as a File.

Returns:
this path

getRelativePath

java.lang.String getRelativePath()
Gets this path as a relative path from the base directory.

Returns:
the relative path

longerThan

boolean longerThan(int maxLen)
Tests if this path is longer than a given value.

Parameters:
maxLen - the value to test
Returns:
true if and only if this path is longer than maxLen

mkdirs

void mkdirs()
      throws java.io.IOException
Creates all directories in this path as needed.

Throws:
java.io.IOException - if a needed directory could not be created
java.io.IOException - if a needed directory is not writeable
java.io.IOException - if a non-directory file exists with the same path as a needed directory


Copyright © 2003-2011 Internet Archive. All Rights Reserved.