Java 类org.apache.lucene.store.SimpleFSDirectory.SimpleFSIndexInput 实例源码

项目:NYBC    文件:TestBufferedIndexInput.java   
public void testReadBytes() throws Exception {
  MyBufferedIndexInput input = new MyBufferedIndexInput();
  runReadBytes(input, BufferedIndexInput.BUFFER_SIZE, random());

  // This tests the workaround code for LUCENE-1566 where readBytesInternal
  // provides a workaround for a JVM Bug that incorrectly raises a OOM Error
  // when a large byte buffer is passed to a file read.
  // NOTE: this does only test the chunked reads and NOT if the Bug is triggered.
  //final int tmpFileSize = 1024 * 1024 * 5;
  final int inputBufferSize = 128;
  File tmpInputFile = _TestUtil.createTempFile("IndexInput", "tmpFile", TEMP_DIR);
  tmpInputFile.deleteOnExit();
  writeBytes(tmpInputFile, TEST_FILE_LENGTH);

  // run test with chunk size of 10 bytes
  runReadBytesAndClose(new SimpleFSIndexInput("SimpleFSIndexInput(path=\"" + tmpInputFile + "\")", tmpInputFile,
      newIOContext(random()), 10), inputBufferSize, random());

  // run test with chunk size of 10 bytes
  runReadBytesAndClose(new NIOFSIndexInput(tmpInputFile,
      newIOContext(random()), 10), inputBufferSize, random());
}
项目:search    文件:TestHelper.java   
/** Returns true if the provided input stream is an SimpleFSIndexInput and
 *  is a clone, that is it does not own its underlying file descriptor.
 */
public static boolean isSimpleFSIndexInputClone(IndexInput is) {
    if (isSimpleFSIndexInput(is)) {
        return ((SimpleFSIndexInput) is).isClone;
    } else {
        return false;
    }
}
项目:search    文件:TestHelper.java   
/** Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
 *  true if the underlying file descriptor is valid, and false otherwise.
 *  This can be used to determine if the OS file has been closed.
 *  The descriptor becomes invalid when the non-clone instance of the
 *  SimpleFSIndexInput that owns this descriptor is closed. However, the
 *  descriptor may possibly become invalid in other ways as well.
 */
public static boolean isSimpleFSIndexInputOpen(IndexInput is)
throws IOException
{
    if (isSimpleFSIndexInput(is)) {
        SimpleFSIndexInput fis = (SimpleFSIndexInput) is;
        return fis.isFDValid();
    } else {
        return false;
    }
}
项目:NYBC    文件:_TestHelper.java   
/** Returns true if the provided input stream is an SimpleFSIndexInput and
 *  is a clone, that is it does not own its underlying file descriptor.
 */
public static boolean isSimpleFSIndexInputClone(IndexInput is) {
    if (isSimpleFSIndexInput(is)) {
        return ((SimpleFSIndexInput) is).isClone;
    } else {
        return false;
    }
}
项目:NYBC    文件:_TestHelper.java   
/** Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
 *  true if the underlying file descriptor is valid, and false otherwise.
 *  This can be used to determine if the OS file has been closed.
 *  The descriptor becomes invalid when the non-clone instance of the
 *  SimpleFSIndexInput that owns this descriptor is closed. However, the
 *  descriptor may possibly become invalid in other ways as well.
 */
public static boolean isSimpleFSIndexInputOpen(IndexInput is)
throws IOException
{
    if (isSimpleFSIndexInput(is)) {
        SimpleFSIndexInput fis = (SimpleFSIndexInput) is;
        return fis.isFDValid();
    } else {
        return false;
    }
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestHelper.java   
/** Returns true if the provided input stream is an SimpleFSIndexInput and
 *  is a clone, that is it does not own its underlying file descriptor.
 */
public static boolean isSimpleFSIndexInputClone(IndexInput is) {
    if (isSimpleFSIndexInput(is)) {
        return ((SimpleFSIndexInput) is).isClone;
    } else {
        return false;
    }
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestHelper.java   
/** Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
 *  true if the underlying file descriptor is valid, and false otherwise.
 *  This can be used to determine if the OS file has been closed.
 *  The descriptor becomes invalid when the non-clone instance of the
 *  SimpleFSIndexInput that owns this descriptor is closed. However, the
 *  descriptor may possibly become invalid in other ways as well.
 */
public static boolean isSimpleFSIndexInputOpen(IndexInput is)
throws IOException
{
    if (isSimpleFSIndexInput(is)) {
        SimpleFSIndexInput fis = (SimpleFSIndexInput) is;
        return fis.isFDValid();
    } else {
        return false;
    }
}
项目:search    文件:TestHelper.java   
/** Returns true if the instance of the provided input stream is actually
 *  an SimpleFSIndexInput.
 */
public static boolean isSimpleFSIndexInput(IndexInput is) {
    return is instanceof SimpleFSIndexInput;
}
项目:NYBC    文件:_TestHelper.java   
/** Returns true if the instance of the provided input stream is actually
 *  an SimpleFSIndexInput.
 */
public static boolean isSimpleFSIndexInput(IndexInput is) {
    return is instanceof SimpleFSIndexInput;
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestHelper.java   
/** Returns true if the instance of the provided input stream is actually
 *  an SimpleFSIndexInput.
 */
public static boolean isSimpleFSIndexInput(IndexInput is) {
    return is instanceof SimpleFSIndexInput;
}