|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.nutch.segment.SegmentWriter
This class holds together all data writers for a new segment. Some convenience methods are also provided, to append to the segment.
Field Summary | |
ArrayFile.Writer |
contentWriter
|
ArrayFile.Writer |
fetcherWriter
|
static Logger |
LOG
|
ArrayFile.Writer |
parseDataWriter
|
ArrayFile.Writer |
parseTextWriter
|
File |
segmentDir
|
long |
size
|
Constructor Summary | |
SegmentWriter(File dir,
boolean force)
|
|
SegmentWriter(File dir,
boolean force,
boolean isParsed)
|
|
SegmentWriter(NutchFileSystem nfs,
File dir,
boolean force)
|
|
SegmentWriter(NutchFileSystem nfs,
File dir,
boolean force,
boolean isParsed)
|
|
SegmentWriter(NutchFileSystem nfs,
File dir,
boolean force,
boolean isParsed,
boolean withContent,
boolean withParseText,
boolean withParseData)
Open a segment for writing. |
Method Summary | |
void |
append(FetcherOutput fo,
Content co,
ParseText pt,
ParseData pd)
Append new values to the output segment. |
void |
close()
Close all writers. |
static String |
getNewSegmentName()
Create a new segment name |
static void |
main(String[] args)
|
void |
setIndexInterval(int interval)
Sets the index interval for all segment writers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Logger LOG
public ArrayFile.Writer fetcherWriter
public ArrayFile.Writer contentWriter
public ArrayFile.Writer parseTextWriter
public ArrayFile.Writer parseDataWriter
public long size
public File segmentDir
Constructor Detail |
public SegmentWriter(File dir, boolean force) throws Exception
public SegmentWriter(NutchFileSystem nfs, File dir, boolean force) throws Exception
public SegmentWriter(File dir, boolean force, boolean isParsed) throws Exception
public SegmentWriter(NutchFileSystem nfs, File dir, boolean force, boolean isParsed) throws Exception
public SegmentWriter(NutchFileSystem nfs, File dir, boolean force, boolean isParsed, boolean withContent, boolean withParseText, boolean withParseData) throws Exception
nfs
- NutchFileSystem to usedir
- directory to contain the segment dataforce
- if true, and segment directory already exists and its content
is in the way, sliently overwrite that content as needed.
If false and the above condition arises, throw an Exception. Note: this
doesn't result in an Exception, if force=false, and the target directory
already exists, but contains other data not conflicting with the segment
data.isParsed
- if true, create a segment with parseData and parseText; otherwise
create a segment without them, and with the fetcher output located in
FetcherOutput.DIR_NAME_NP
directory.withContent
- if true, write Content, otherwise ignore itwithParseText
- if true, write ParseText, otherwise ignore it. NOTE: if isParsed is
false, this will be automaticaly set to false, too.withParseData
- if true, write ParseData, otherwise ignore it. NOTE: if isParsed is
false, this will be automaticaly set to false, too.
Exception
Method Detail |
public static String getNewSegmentName()
public void setIndexInterval(int interval) throws IOException
IOException
public void append(FetcherOutput fo, Content co, ParseText pt, ParseData pd) throws IOException
NOTE: if this segment writer has some data files open, but the respective arguments are null, empty values will be written instead.
fo
- fetcher output, must not be nullco
- content, may be null (but see the note above)pt
- parseText, may be null (but see the note above)pd
- parseData, may be null (but see the note above)
IOException
public void close()
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |