/** * Returns an iterator on the tracked blob ids. * * @return record iterator * @throws IOException */ protected Iterator<String> getRecords() throws IOException { try { // Get a temp file path String path = createTempFile("temp", null).getAbsolutePath(); return wrap(lineIterator(getRecords(path)), new File(path)); } catch (IOException e) { LOG.error("Error in retrieving blob records iterator", e); throw e; } }
/** * Returns an iterator on the tracked blob ids. * * @return record iterator * @throws IOException */ protected Iterator<String> getRecords() throws IOException { try { // Get a temp file path String path = createTempFile("temp", null).getAbsolutePath(); return wrap(lineIterator(getRecords(path)), new File(path)); } catch (IOException e) { LOG.error("Error in retrieving blob records iterator", e); throw e; } }
/** * Returns an iterator on the tracked blob ids. * * @return record iterator * @throws IOException */ protected Iterator<String> getRecords() throws IOException { try { // Get a temp file path String path = createTempFile("temp", null).getAbsolutePath(); return wrap(lineIterator(getRecords(path)), new File(path)); } catch (IOException e) { LOG.error("Error in retrieving blob records iterator", e); throw e; } }
@Test public void fileIteratorBurnTest() throws Exception { Set<String> added = newHashSet("a", "z", "e", "b"); File f = assertWrite(added.iterator(), false, added.size()); BurnOnCloseFileIterator iterator = BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString()), f); assertEquals(added, Sets.newHashSet(iterator)); assertTrue(!f.exists()); }
@Test public void fileIteratorTest() throws Exception { Set<String> added = newHashSet("a", "z", "e", "b"); File f = assertWrite(added.iterator(), false, added.size()); BurnOnCloseFileIterator iterator = BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString())); assertEquals(added, Sets.newHashSet(iterator)); assertTrue(f.exists()); }