org.elasticsearch.util.lucene
Class Directories

java.lang.Object
  extended by org.elasticsearch.util.lucene.Directories

public class Directories
extends java.lang.Object

A set of utilities for Lucene Directory.


Method Summary
static long checksum(org.apache.lucene.store.Directory dir, java.lang.String name)
          Computes the checksum of the given file name with the directory.
static long checksum(org.apache.lucene.store.IndexInput indexInput)
          Computes the checksum of the content represented by the provided index input.
static void copyFromDirectory(org.apache.lucene.store.Directory dir, java.lang.String fileName, java.io.File copyTo)
           
static void copyFromDirectory(org.apache.lucene.store.IndexInput ii, java.io.OutputStream os)
           
static void copyToDirectory(java.io.File copyFrom, org.apache.lucene.store.Directory dir, java.lang.String fileName)
           
static void copyToDirectory(java.io.InputStream is, org.apache.lucene.store.Directory dir, java.lang.String fileName)
           
static void copyToDirectory(java.io.InputStream is, org.apache.lucene.store.IndexOutput io)
           
static void deleteFiles(org.apache.lucene.store.Directory directory)
          Deletes all the files from a directory.
static SizeValue estimateSize(org.apache.lucene.store.Directory directory)
          Returns the estimated size of a Directory.
static java.util.Collection<org.apache.lucene.index.IndexCommit> listCommits(org.apache.lucene.store.Directory directory)
          Lists all the commit point in a directory.
static void sync(org.apache.lucene.store.Directory dir, java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deleteFiles

public static void deleteFiles(org.apache.lucene.store.Directory directory)
                        throws java.io.IOException
Deletes all the files from a directory.

Parameters:
directory - The directoy to delete all the files from
Throws:
java.io.IOException - if an exception occurs during the delete process

estimateSize

public static SizeValue estimateSize(org.apache.lucene.store.Directory directory)
                              throws java.io.IOException
Returns the estimated size of a Directory.

Throws:
java.io.IOException

listCommits

public static java.util.Collection<org.apache.lucene.index.IndexCommit> listCommits(org.apache.lucene.store.Directory directory)
                                                                             throws java.io.IOException
Lists all the commit point in a directory.

Throws:
java.io.IOException

checksum

public static long checksum(org.apache.lucene.store.Directory dir,
                            java.lang.String name)
                     throws java.io.IOException
Computes the checksum of the given file name with the directory.

Throws:
java.io.IOException

copyFromDirectory

public static void copyFromDirectory(org.apache.lucene.store.Directory dir,
                                     java.lang.String fileName,
                                     java.io.File copyTo)
                              throws java.io.IOException
Throws:
java.io.IOException

copyFromDirectory

public static void copyFromDirectory(org.apache.lucene.store.IndexInput ii,
                                     java.io.OutputStream os)
                              throws java.io.IOException
Throws:
java.io.IOException

copyToDirectory

public static void copyToDirectory(java.io.File copyFrom,
                                   org.apache.lucene.store.Directory dir,
                                   java.lang.String fileName)
                            throws java.io.IOException
Throws:
java.io.IOException

copyToDirectory

public static void copyToDirectory(java.io.InputStream is,
                                   org.apache.lucene.store.Directory dir,
                                   java.lang.String fileName)
                            throws java.io.IOException
Throws:
java.io.IOException

sync

public static void sync(org.apache.lucene.store.Directory dir,
                        java.lang.String fileName)
                 throws java.io.IOException
Throws:
java.io.IOException

copyToDirectory

public static void copyToDirectory(java.io.InputStream is,
                                   org.apache.lucene.store.IndexOutput io)
                            throws java.io.IOException
Throws:
java.io.IOException

checksum

public static long checksum(org.apache.lucene.store.IndexInput indexInput)
                     throws java.io.IOException
Computes the checksum of the content represented by the provided index input.

Closes the index input once checksum is computed.

Throws:
java.io.IOException