|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.index.IndexFileNames
public final class IndexFileNames
This class contains useful constants representing filenames and extensions
used by lucene, as well as convenience methods for querying whether a file
name matches an extension (matchesExtension
), as well as generating file names from a segment name,
generation and extension (
fileNameFromGeneration
,
segmentFileName
).
NOTE: extensions used by codecs are not
listed here. You must interact with the Codec
directly.
Field Summary | |
---|---|
static Pattern |
CODEC_FILE_PATTERN
All files created by codecs much match this pattern (checked in SegmentInfo). |
static String |
COMPOUND_FILE_ENTRIES_EXTENSION
Extension of compound file entries |
static String |
COMPOUND_FILE_EXTENSION
Extension of compound file |
static String |
GEN_EXTENSION
Extension of gen file |
static String[] |
INDEX_EXTENSIONS
This array contains all filename extensions used by Lucene's index files, with one exception, namely the extension made up from .s + a number. |
static String |
SEGMENTS
Name of the index segment file |
static String |
SEGMENTS_GEN
Name of the generation reference file name |
Method Summary | |
---|---|
static String |
fileNameFromGeneration(String base,
String ext,
long gen)
Computes the full file name from base, extension and generation. |
static boolean |
matchesExtension(String filename,
String ext)
Returns true if the given filename ends with the given extension. |
static String |
parseSegmentName(String filename)
Parses the segment name out of the given file name. |
static String |
segmentFileName(String segmentName,
String segmentSuffix,
String ext)
Returns a file name that includes the given segment name, your own custom name and extension. |
static String |
stripExtension(String filename)
Removes the extension (anything after the first '.'), otherwise returns the original filename. |
static String |
stripSegmentName(String filename)
Strips the segment name out of the given file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SEGMENTS
public static final String GEN_EXTENSION
public static final String SEGMENTS_GEN
public static final String COMPOUND_FILE_EXTENSION
public static final String COMPOUND_FILE_ENTRIES_EXTENSION
public static final String[] INDEX_EXTENSIONS
.s
+ a number.
Also note that Lucene's segments_N
files
do not have any filename extension.
public static final Pattern CODEC_FILE_PATTERN
Method Detail |
---|
public static String fileNameFromGeneration(String base, String ext, long gen)
ext
is
not an empty string.
base
- main part of the file nameext
- extension of the filenamegen
- generationpublic static String segmentFileName(String segmentName, String segmentSuffix, String ext)
NOTE: .<ext> is added to the result file name only if
ext
is not empty.
NOTE: _<segmentSuffix> is added to the result file name only if it's not the empty string
NOTE: all custom files should be named using this method, or otherwise some structures may fail to handle them properly (such as if they are added to compound files).
public static boolean matchesExtension(String filename, String ext)
public static String stripSegmentName(String filename)
segmentFileName(java.lang.String, java.lang.String, java.lang.String)
or fileNameFromGeneration(java.lang.String, java.lang.String, long)
to create your
files, then this method simply removes whatever comes before the first '.',
or the second '_' (excluding both).
public static String parseSegmentName(String filename)
public static String stripExtension(String filename)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |