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 BytesRef
DOC
(package private) static BytesRef
END
(package private) static BytesRef
FIELD
(package private) static java.lang.String
FIELDS_EXTENSION
(package private) static BytesRef
NAME
private int
numDocsWritten
private IndexOutput
out
private BytesRefBuilder
scratch
(package private) static BytesRef
TYPE
(package private) static BytesRef
TYPE_BINARY
(package private) static BytesRef
TYPE_DOUBLE
(package private) static BytesRef
TYPE_FLOAT
(package private) static BytesRef
TYPE_INT
(package private) static BytesRef
TYPE_LONG
(package private) static BytesRef
TYPE_STRING
(package private) static BytesRef
VALUE
-
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 void
close()
void
finish(FieldInfos fis, int numDocs)
Called beforeStoredFieldsWriter.close()
, passing in the number of documents that were written.private void
newLine()
long
ramBytesUsed()
Return the memory usage of this object in bytes.void
startDocument()
Called before writing the stored fields of the document.private void
write(java.lang.String s)
private void
write(BytesRef bytes)
void
writeField(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.IOException
Description copied from class:StoredFieldsWriter
Called 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:
startDocument
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
writeField
public void writeField(FieldInfo info, IndexableField field) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Writes a single stored field.- Specified by:
writeField
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
finish
public void finish(FieldInfos fis, int numDocs) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Called 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:
finish
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in 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:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.
-
-