@Test public void test2() throws IOException { Cache cache = CacheIndexInputTest.getCache(); RAMDirectory directory = new RAMDirectory(); RAMDirectory directory2 = new RAMDirectory(); Random random = new Random(seed); String name = "test2"; long size = (10 * 1024 * 1024) + 13; IndexOutput output = directory.createOutput(name, IOContext.DEFAULT); CacheIndexOutput cacheIndexOutput = new CacheIndexOutput(null, name, cache, directory2, IOContext.DEFAULT); CacheIndexInputTest.writeRandomData(size, random, output, cacheIndexOutput); output.close(); cacheIndexOutput.close(); IndexInput input = directory.openInput(name, IOContext.DEFAULT); IndexInput testInput = directory2.openInput(name, IOContext.DEFAULT); CacheIndexInputTest.readRandomData(input, testInput, random, sampleSize, maxBufSize, maxOffset); testInput.close(); input.close(); directory.close(); directory2.close(); }
@Override public void close() throws IOException { flushInternal(); _indexOutput.flush(); _indexOutput.close(); _store.putBuffer(_buffer); _cache.fileClosedForWriting(_directory, _fileName, _fileId); }
CacheIndexOutput extends IndexOutput { @Override public void close() throws IOException { flushInternal(); _indexOutput.flush(); _indexOutput.close(); _store.putBuffer(_buffer); _cache.fileClosedForWriting(_directory, _fileName, _fileId); } }
CacheIndexOutput extends IndexOutput { @Override public void close() throws IOException { flushInternal(); _indexOutput.flush(); _indexOutput.close(); _store.putBuffer(_buffer); _cache.fileClosedForWriting(_directory, _fileName, _fileId); } CacheIndexOutput(CacheDirectory directory, String fileName, Cache cache, Directory dir, IOContext context); }
CacheIndexOutput extends IndexOutput { @Override public void close() throws IOException { flushInternal(); _indexOutput.flush(); _indexOutput.close(); _store.putBuffer(_buffer); _cache.fileClosedForWriting(_directory, _fileName, _fileId); } CacheIndexOutput(CacheDirectory directory, String fileName, Cache cache, Directory dir, IOContext context); @Override void setLength(long length); @Override void writeByte(byte b); @Override void writeBytes(byte[] b, int offset, int len); @Override void seek(long pos); @Override void close(); @Override void flush(); @Override long getFilePointer(); @Override long length(); }
CacheIndexOutput extends IndexOutput { @Override public void close() throws IOException { flushInternal(); _indexOutput.flush(); _indexOutput.close(); _store.putBuffer(_buffer); _cache.fileClosedForWriting(_directory, _fileName, _fileId); } CacheIndexOutput(CacheDirectory directory, String fileName, Cache cache, Directory dir, IOContext context); @Override void setLength(long length); @Override void writeByte(byte b); @Override void writeBytes(byte[] b, int offset, int len); @Override void seek(long pos); @Override void close(); @Override void flush(); @Override long getFilePointer(); @Override long length();  }