public class TokenStreams extends Object
| Constructor and Description |
|---|
TokenStreams() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(Closeable closeable)
Unconditionally close a
Closeable. |
static void |
endQuietly(org.apache.lucene.analysis.TokenStream tokenStream)
End streams quietly.
|
public static void endQuietly(org.apache.lucene.analysis.TokenStream tokenStream)
IOException.tokenStream - TokenStream to be closed.public static void closeQuietly(Closeable closeable)
Closeable.
Equivalent to Closeable.close(), except any exceptions will be ignored. This is typically used in finally
blocks.
Example code:
Closeable closeable = null;
try {
closeable = new FileReader("foo.txt");
// process closeable
closeable.close();
} catch (Exception e) {
// error handling
} finally {
IOUtils.closeQuietly(closeable);
}
closeable - the object to close, may be null or already closedCopyright © 2020. All rights reserved.