Package org.apache.lucene.store

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


        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());
        }
View Full Code Here


        // writing segments file:
        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());
        }
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());
        }
View Full Code Here

        out.write(data);
        out.close();

        byte[] buf = new byte[3];
        int pos = 0;
        IndexInput in = dir.openInput("test");
        for (;;) {
            int len = (int) Math.min(buf.length, in.length() - pos);
            in.readBytes(buf, 0, len);
            for (int i = 0; i < len; i++, pos++) {
                assertEquals(data[pos], buf[i]);
View Full Code Here

        rand.nextBytes(data);
        Directory dir = new RAMDirectory();
        IndexOutput out = dir.createOutput("test");
        out.writeBytes(data, data.length);
        out.close();
        InputStream in = new IndexInputStream(dir.openInput("test"));
        if (buffer != 0) {
            in = new BufferedInputStream(in, buffer);
        }
        byte[] buf = new byte[3];
        int len;
View Full Code Here

    RAMDirectory dir = new RAMDirectory();
    IndexOutput stream = dir.createOutput("foo.txt");
    pool.writePool(stream);
    stream.flush();
    stream.close();
    IndexInput input = dir.openInput("foo.txt");
    assertEquals(pool.byteOffset + pool.byteUpto, stream.length());
    BytesRef expected = new BytesRef();
    BytesRef actual = new BytesRef();
    for (String string : list) {
      expected.copyChars(string);
View Full Code Here

        // writing segments file:
        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());
        }
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());
        }
View Full Code Here

            output.writeByte((byte) 2);
        }

        output.close();

        IndexInput input = dir.openInput("test", IOContext.DEFAULT);

        for (int i = 0; i < 3; i++) {
            InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
            assertThat(input.getFilePointer(), lessThan(input.length()));
            assertThat(is.actualSizeToRead(), equalTo(1l));
View Full Code Here

            output.writeByte((byte) 2);
        }

        output.close();

        IndexInput input = dir.openInput("test", IOContext.DEFAULT);

        byte[] read = new byte[2];

        for (int i = 0; i < 3; i++) {
            assertThat(input.getFilePointer(), lessThan(input.length()));
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.