org.archive.crawler.writer
Class MirrorWriterProcessor.DirSegment

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

 class MirrorWriterProcessor.DirSegment
extends MirrorWriterProcessor.PathSegment

This class represents one directory segment (component) of a URI path.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.archive.crawler.writer.MirrorWriterProcessor.PathSegment
MirrorWriterProcessor.PathSegment.CaseInsensitiveFilenameFilter
 
Field Summary
 
Fields inherited from class org.archive.crawler.writer.MirrorWriterProcessor.PathSegment
curi, EXISTS_CASE_INSENSITIVE_MATCH, EXISTS_EXACT_MATCH, EXISTS_NOT, mainPart, maxSegLen
 
Constructor Summary
MirrorWriterProcessor.DirSegment(java.lang.String uriPath, int beginIndex, int endIndex, int maxSegLen, boolean caseSensitive, CrawlURI curi, java.util.Map characterMap, java.lang.String dotBegin, java.lang.String dotEnd, java.util.Set underscoreSet)
          Creates a DirSegment.
 
Method Summary
(package private)  void addToPath(MirrorWriterProcessor.URIToFileReturn currentPath)
          Adds this segment to a file path.
 
Methods inherited from class org.archive.crawler.writer.MirrorWriterProcessor.PathSegment
existsMaybeCaseSensitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MirrorWriterProcessor.DirSegment

MirrorWriterProcessor.DirSegment(java.lang.String uriPath,
                                 int beginIndex,
                                 int endIndex,
                                 int maxSegLen,
                                 boolean caseSensitive,
                                 CrawlURI curi,
                                 java.util.Map characterMap,
                                 java.lang.String dotBegin,
                                 java.lang.String dotEnd,
                                 java.util.Set underscoreSet)
Creates a DirSegment.

Parameters:
uriPath - the path part of the URI
beginIndex - the beginning index, inclusive, of the substring of uriPath to be used
endIndex - the ending index, exclusive, of the substring of uriPath to be used
maxSegLen - the maximum number of characters allowed in one file system path segment (component)
caseSensitive - if true, the file system is assumed to be case-sensitive; otherwise the file system is assumed to be case-insensitive but case-preserving
curi - the URI
characterMap - a map from characters (as length-1 String values) in the URI path and query to replacement String values
dotBegin - if non-null, this replaces a '.' at the beginning of the directory name
dotEnd - if non-null, this replaces a '.' that appears at the end of a directory name
underscoreSet - if non-null and a segment, after conversion to lower case, is in this set, then prepend an underscore to the segment
Throws:
java.lang.IllegalArgumentException - if beginIndex is negative.
java.lang.IllegalArgumentException - if endIndex is less than beginIndex.
java.lang.IllegalArgumentException - if maxSegLen is too small.
Method Detail

addToPath

void addToPath(MirrorWriterProcessor.URIToFileReturn currentPath)
         throws java.io.IOException
Description copied from class: MirrorWriterProcessor.PathSegment
Adds this segment to a file path. This is the key method of this class. It extends the given path by one segment, named to obey all constraints. A new directory is created if necessary.

Specified by:
addToPath in class MirrorWriterProcessor.PathSegment
Parameters:
currentPath - the current path, to which this segment is added
Throws:
java.io.IOException - if a needed directory could not be created


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