Examples of openSlice()


Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    IndexOutput io = mmapDir.createOutput("bytes", newIOContext(random()));
    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    IndexInput three = one.clone(); // clone of clone
    IndexInput four = two.clone(); // clone of clone
    slicer.close();
    try {
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    IndexInput three = one.clone(); // clone of clone
    IndexInput four = two.clone(); // clone of clone
    slicer.close();
    try {
      one.readInt();
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    IndexOutput io = mmapDir.createOutput("bytes", newIOContext(random()));
    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    one.close();
    try {
      one.readInt();
      fail("Must throw AlreadyClosedException");
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    one.close();
    try {
      one.readInt();
      fail("Must throw AlreadyClosedException");
    } catch (AlreadyClosedException ignore) {
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    } catch (AlreadyClosedException ignore) {
      // pass
    }
    assertEquals(2, two.readInt());
    // reopen a new slice "one":
    one = slicer.openSlice("first int", 0, 4);
    assertEquals(1, one.readInt());
    one.close();
    two.close();
    slicer.close();
    mmapDir.close();
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    for (int i = 0; i < 31; i++) {
      MMapDirectory mmapDir = new MMapDirectory(_TestUtil.getTempDir("testSeekSliceZero"), null, 1<<i);
      IndexOutput io = mmapDir.createOutput("zeroBytes", newIOContext(random()));
      io.close();
      IndexInputSlicer slicer = mmapDir.createSlicer("zeroBytes", newIOContext(random()));
      IndexInput ii = slicer.openSlice("zero-length slice", 0, 0);
      ii.seek(0L);
      ii.close();
      slicer.close();
      mmapDir.close();
    }
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

      byte bytes[] = new byte[1<<i];
      random().nextBytes(bytes);
      io.writeBytes(bytes, bytes.length);
      io.close();
      IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
      IndexInput ii = slicer.openSlice("full slice", 0, bytes.length);
      byte actual[] = new byte[1<<i];
      ii.readBytes(actual, 0, actual.length);
      assertEquals(new BytesRef(bytes), new BytesRef(actual));
      ii.seek(1<<i);
      ii.close();
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

      assertEquals(new BytesRef(bytes), new BytesRef(actual));
      IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
      for (int sliceStart = 0; sliceStart < bytes.length; sliceStart++) {
        for (int sliceLength = 0; sliceLength < bytes.length - sliceStart; sliceLength++) {
          byte slice[] = new byte[sliceLength];
          IndexInput input = slicer.openSlice("bytesSlice", sliceStart, slice.length);
          input.readBytes(slice, 0, slice.length);
          input.close();
          assertEquals(new BytesRef(bytes, sliceStart, sliceLength), new BytesRef(slice));
        }
      }
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    IndexOutput io = mmapDir.createOutput("bytes", newIOContext(random()));
    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    IndexInput three = one.clone(); // clone of clone
    IndexInput four = two.clone(); // clone of clone
    slicer.close();
    try {
View Full Code Here

Examples of org.apache.lucene.store.Directory.IndexInputSlicer.openSlice()

    io.writeInt(1);
    io.writeInt(2);
    io.close();
    IndexInputSlicer slicer = mmapDir.createSlicer("bytes", newIOContext(random()));
    IndexInput one = slicer.openSlice("first int", 0, 4);
    IndexInput two = slicer.openSlice("second int", 4, 4);
    IndexInput three = one.clone(); // clone of clone
    IndexInput four = two.clone(); // clone of clone
    slicer.close();
    try {
      one.readInt();
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.