TransactionStateLuceneIndexWriter( LuceneFulltextIndex index ) { this.index = index; directory = new RAMDirectory(); }
@Override public final int readInt() throws IOException { try { return guard.getInt(curBuf); } catch (BufferUnderflowException e) { return super.readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
/** Just like {@link #open(Path)}, but allows you to * also specify a custom {@link LockFactory}. */ public static FSDirectory open(Path path, LockFactory lockFactory) throws IOException { if (Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) { return new MMapDirectory(path, lockFactory); } else if (Constants.WINDOWS) { return new SimpleFSDirectory(path, lockFactory); } else { return new NIOFSDirectory(path, lockFactory); } }
@SuppressWarnings( "ResultOfMethodCallIgnored" ) @Override public Directory open( File dir ) throws IOException { dir.mkdirs(); FSDirectory directory = USE_DEFAULT_DIRECTORY_FACTORY ? FSDirectory.open( dir.toPath() ) : new NIOFSDirectory( dir.toPath() ); return new NRTCachingDirectory( directory, MAX_MERGE_SIZE_MB, MAX_CACHED_MB ); }
@Override public void close() throws IOException { delegate.close(); } }
@Override public final long readLong() throws IOException { try { return guard.getLong(curBuf); } catch (BufferUnderflowException e) { return super.readLong(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public String[] listAll() throws IOException { return delegate.listAll(); }
@Override public IndexInput openInput( String name, IOContext context ) throws IOException { return delegate.openInput( name, context ); }
@Override public IndexOutput createOutput( String name, IOContext context ) throws IOException { return delegate.createOutput( name, context ); }
@Override public void deleteFile( String name ) throws IOException { delegate.deleteFile( name ); }
@Override public long fileLength( String name ) throws IOException { return delegate.fileLength( name ); }
@Override public Lock obtainLock( String name ) throws IOException { return delegate.obtainLock( name ); }
public static ByteBufferIndexInput newInstance(String resourceDescription, ByteBuffer[] buffers, long length, int chunkSizePower, ByteBufferGuard guard) { if (buffers.length == 1) { return new SingleBufferImpl(resourceDescription, buffers[0], length, chunkSizePower, guard); } else { return new MultiBufferImpl(resourceDescription, buffers, 0, length, chunkSizePower, guard); } }
@Override public void renameFile( String source, String dest ) throws IOException { delegate.renameFile( source, dest ); }
@Override public void skipBytes(long numBytes) throws IOException { ensureOpen(); super.skipBytes(numBytes); }
@Override public void writeLong(long i) throws IOException { ensureOpen(); delegate.writeLong(i); }
@Override public void writeString(String s) throws IOException { ensureOpen(); delegate.writeString(s); }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { ensureOpen(); in.readBytes(b, offset, len); }
@Override public byte readByte(long pos) throws IOException { ensureOpen(); return in.readByte(pos); }
@Override Directory getDirectory( File baseStorePath, IndexIdentifier identifier ) { return new RAMDirectory(); }