Example usage for org.apache.lucene.store IndexInput IndexInput

List of usage examples for org.apache.lucene.store IndexInput IndexInput

Introduction

In this page you can find the example usage for org.apache.lucene.store IndexInput IndexInput.

Prototype

IndexInput

Source Link

Usage

From source file:com.nearinfinity.mele.zookeeper.ZookeeperWrapperDirectory.java

License:Apache License

private IndexInput wrapRef(final String name, final IndexInput indexInput) {
    final String refPath = ZookeeperIndexDeletionPolicy.createRef(zk, indexRefPath, name);
    return new IndexInput() {

        @Override//ww  w.  j a  v  a  2s.c  o  m
        public void close() throws IOException {
            indexInput.close();
            ZookeeperIndexDeletionPolicy.removeRef(zk, refPath);
        }

        @Override
        public long getFilePointer() {
            return indexInput.getFilePointer();
        }

        @Override
        public long length() {
            return indexInput.length();
        }

        @Override
        public byte readByte() throws IOException {
            return indexInput.readByte();
        }

        @Override
        public void readBytes(byte[] b, int offset, int len) throws IOException {
            indexInput.readBytes(b, offset, len);
        }

        @Override
        public void seek(long pos) throws IOException {
            indexInput.seek(pos);
        }

        @Override
        public Object clone() {
            return indexInput.clone();
        }
    };
}