Package org.apache.lucene.store

Examples of org.apache.lucene.store.RAMDirectory.createOutput()


      for (PackedInts.Mutable mutable : packedInts) {
        for (int i = 0; i < mutable.size(); ++i) {
          mutable.set(i, random().nextInt(maxValue));
        }

        IndexOutput out = directory.createOutput("packed-ints.bin", IOContext.DEFAULT);
        mutable.save(out);
        out.close();

        IndexInput in = directory.openInput("packed-ints.bin", IOContext.DEFAULT);
        PackedInts.Reader reader = PackedInts.getReader(in);
View Full Code Here


        String fileNameIn = SegmentInfos.getCurrentSegmentFileName(dir);
        String fileNameOut = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS,
                                                                   "",
                                                                   1+gen);
        IndexInput in = dir.openInput(fileNameIn);
        IndexOutput out = dir.createOutput(fileNameOut);
        long length = in.length();
        for(int i=0;i<length-1;i++) {
          out.writeByte(in.readByte());
        }
        in.close();
View Full Code Here

        String fileNameIn = SegmentInfos.getCurrentSegmentFileName(dir);
        String fileNameOut = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS,
                                                                   "",
                                                                   1+gen);
        IndexInput in = dir.openInput(fileNameIn);
        IndexOutput out = dir.createOutput(fileNameOut);
        long length = in.length();
        for(int i=0;i<length-1;i++) {
          out.writeByte(in.readByte());
        }
        in.close();
View Full Code Here

*/
public class InputStreamIndexInputTests {

    @Test public void testSingleReadSingleByteLimit() throws IOException {
        RAMDirectory dir = new RAMDirectory();
        IndexOutput output = dir.createOutput("test");
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 1);
        }
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 2);
View Full Code Here

        assertThat(is.read(), equalTo(-1));
    }

    @Test public void testReadMultiSingleByteLimit1() throws IOException {
        RAMDirectory dir = new RAMDirectory();
        IndexOutput output = dir.createOutput("test");
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 1);
        }
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 2);
View Full Code Here

        assertThat(is.read(read), equalTo(-1));
    }

    @Test public void testSingleReadTwoBytesLimit() throws IOException {
        RAMDirectory dir = new RAMDirectory();
        IndexOutput output = dir.createOutput("test");
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 1);
        }
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 2);
View Full Code Here

        assertThat(is.read(), equalTo(-1));
    }

    @Test public void testReadMultiTwoBytesLimit1() throws IOException {
        RAMDirectory dir = new RAMDirectory();
        IndexOutput output = dir.createOutput("test");
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 1);
        }
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 2);
View Full Code Here

        assertThat(is.read(read), equalTo(-1));
    }

    @Test public void testReadMultiFourBytesLimit() throws IOException {
        RAMDirectory dir = new RAMDirectory();
        IndexOutput output = dir.createOutput("test");
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 1);
        }
        for (int i = 0; i < 3; i++) {
            output.writeByte((byte) 2);
View Full Code Here

  @Test
  public void test1() throws IOException {
    Random random = new Random(seed);
    RAMDirectory directory = new RAMDirectory();
    IndexOutput output = directory.createOutput("test", IOContext.DEFAULT);

    Cache cache = CacheIndexInputTest.getCache();
    CacheIndexOutput indexOutput = new CacheIndexOutput(null, "test", output, cache);
    indexOutput.writeByte((byte) 1);
    indexOutput.writeByte((byte) 2);
View Full Code Here

    String name = "test2";
    long size = (10 * 1024 * 1024) + 13;

    IndexOutput output = directory.createOutput(name, IOContext.DEFAULT);
    IndexOutput output2 = directory2.createOutput(name, IOContext.DEFAULT);
    CacheIndexOutput cacheIndexOutput = new CacheIndexOutput(null, name, output2, cache);
    CacheIndexInputTest.writeRandomData(size, random, output, cacheIndexOutput);
    output.close();
    cacheIndexOutput.close();

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.