Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory.fileLength()


      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here


    System.out.print(end.getTime() - start.getTime());
    System.out.println(" milliseconds to write table");

    System.out.println(" table occupies " +
           store.fileLength("words.tis") + " bytes");

    start = new Date();

    TermInfosReader reader = new TermInfosReader(store, "words", fis);
View Full Code Here

    assertTrue(output != null);
    //Use a RAMOutputStream
   
      fieldInfos.write(output);
      output.close();
      assertTrue(dir.fileLength(name) > 0);
      FieldInfos readIn = new FieldInfos(dir, name);
      assertTrue(fieldInfos.size() == readIn.size());
      FieldInfo info = readIn.fieldInfo("textField1");
      assertTrue(info != null);
      assertTrue(info.storeTermVector == false);
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

      int numToClear = random().nextInt(5);
      for(int i=0;i<numToClear;i++) {
        bv.clear(random().nextInt(numBits));
      }
      bv.write(d, "test", newIOContext(random()));
      final long size = d.fileLength("test");
      assertTrue("size=" + size, size < 100);
      d.close();
    }

    public void testClearedBitNearEnd() throws IOException {
View Full Code Here

         @Override
         public IndexInputMock answer(InvocationOnMock invocationOnMock) throws Throwable {
            return new IndexInputMock(FILE_NAME);
         }
      });
      when(mockDirectory.fileLength(FILE_NAME)).thenReturn(TEST_SIZE);
      verify(mockDirectory, never()).listAll();
      verify(mockDirectory, never()).fileExists(FILE_NAME);
      return mockDirectory;
   }
View Full Code Here

   @Test
   public void testFileLength() throws IOException {
      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, "indexName").create();
         AssertJUnit.assertEquals(0, dir.fileLength("nonExistentFile.txt"));
      } finally {
         if (dir != null) dir.close();
      }
   }
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

        System.out.println("================");
        String[] fileNames = dir.listAll();
        Arrays.sort(fileNames);
        for (String file : fileNames){
            System.out.printf("%s - %d %n", file, dir.fileLength(file));
        }
        releaseIndexNode();
    }

    static Calendar createCal(String dt) throws java.text.ParseException {
View Full Code Here

        assertEquals(2, wrapped.listAll().length);

        assertTrue(wrapped.fileExists("t1"));
        assertTrue(wrapped.fileExists("t2"));

        assertEquals(t1.length, wrapped.fileLength("t1"));
        assertEquals(t2.length, wrapped.fileLength("t2"));

        readAndAssert(wrapped, "t1", t1);

        //t1 should now be added to testDir
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.