Class SimpleTextStoredFieldsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.StoredFieldsWriter
-
- org.apache.lucene.codecs.simpletext.SimpleTextStoredFieldsWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Accountable
public class SimpleTextStoredFieldsWriter extends StoredFieldsWriter
Writes plain-text stored fields.FOR RECREATIONAL USE ONLY
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.codecs.StoredFieldsWriter
StoredFieldsWriter.MergeVisitor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static BytesRefDOC(package private) static BytesRefEND(package private) static BytesRefFIELD(package private) static java.lang.StringFIELDS_EXTENSION(package private) static BytesRefNAMEprivate intnumDocsWrittenprivate IndexOutputoutprivate BytesRefBuilderscratch(package private) static BytesRefTYPE(package private) static BytesRefTYPE_BINARY(package private) static BytesRefTYPE_DOUBLE(package private) static BytesRefTYPE_FLOAT(package private) static BytesRefTYPE_INT(package private) static BytesRefTYPE_LONG(package private) static BytesRefTYPE_STRING(package private) static BytesRefVALUE-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description SimpleTextStoredFieldsWriter(Directory directory, java.lang.String segment, IOContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidfinish(FieldInfos fis, int numDocs)Called beforeStoredFieldsWriter.close(), passing in the number of documents that were written.private voidnewLine()longramBytesUsed()Return the memory usage of this object in bytes.voidstartDocument()Called before writing the stored fields of the document.private voidwrite(java.lang.String s)private voidwrite(BytesRef bytes)voidwriteField(FieldInfo info, IndexableField field)Writes a single stored field.-
Methods inherited from class org.apache.lucene.codecs.StoredFieldsWriter
finishDocument, merge
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
numDocsWritten
private int numDocsWritten
-
out
private IndexOutput out
-
FIELDS_EXTENSION
static final java.lang.String FIELDS_EXTENSION
- See Also:
- Constant Field Values
-
TYPE_STRING
static final BytesRef TYPE_STRING
-
TYPE_BINARY
static final BytesRef TYPE_BINARY
-
TYPE_INT
static final BytesRef TYPE_INT
-
TYPE_LONG
static final BytesRef TYPE_LONG
-
TYPE_FLOAT
static final BytesRef TYPE_FLOAT
-
TYPE_DOUBLE
static final BytesRef TYPE_DOUBLE
-
END
static final BytesRef END
-
DOC
static final BytesRef DOC
-
FIELD
static final BytesRef FIELD
-
NAME
static final BytesRef NAME
-
TYPE
static final BytesRef TYPE
-
VALUE
static final BytesRef VALUE
-
scratch
private final BytesRefBuilder scratch
-
-
Method Detail
-
startDocument
public void startDocument() throws java.io.IOExceptionDescription copied from class:StoredFieldsWriterCalled before writing the stored fields of the document.StoredFieldsWriter.writeField(FieldInfo, IndexableField)will be called for each stored field. Note that this is called even if the document has no stored fields.- Specified by:
startDocumentin classStoredFieldsWriter- Throws:
java.io.IOException
-
writeField
public void writeField(FieldInfo info, IndexableField field) throws java.io.IOException
Description copied from class:StoredFieldsWriterWrites a single stored field.- Specified by:
writeFieldin classStoredFieldsWriter- Throws:
java.io.IOException
-
finish
public void finish(FieldInfos fis, int numDocs) throws java.io.IOException
Description copied from class:StoredFieldsWriterCalled beforeStoredFieldsWriter.close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls toStoredFieldsWriter.startDocument(), but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.- Specified by:
finishin classStoredFieldsWriter- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classStoredFieldsWriter- Throws:
java.io.IOException
-
write
private void write(java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
write
private void write(BytesRef bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
newLine
private void newLine() throws java.io.IOException- Throws:
java.io.IOException
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.
-
-