public void mark() { seekable.mark(); } }
@Override public final void mark(int pLimit) { mark(); // TODO: We don't really need to do this.. Is it a good idea? try { flushBefore(Math.max(position - pLimit, flushedPosition)); } catch (IOException ignore) { // Ignore, as it's not really critical } }
protected static void markReset(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 10; i++) { pSeekable.mark(); System.out.println(new String(FileUtil.read(pSeekable))); pSeekable.reset(); } System.out.println(); System.out.println("mark/reset ok!"); }
protected static void timeRead(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 5000; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long start = System.currentTimeMillis(); final int times = 200000; for (int i = 0; i < times; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long time = System.currentTimeMillis() - start; System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)"); }
public void mark() { mSeekable.mark(); } }
public void mark() { seekable.mark(); } }
@Test public void testMarkFlushReset() throws Exception { SeekableInputStream seekable = makeInputStream(77); seekable.mark(); int position = 55; seekable.seek(position); seekable.flushBefore(position); try { seekable.reset(); fail("Reset before flushed position succeeded"); } catch (IOException e) { // Ignore } assertEquals(position, seekable.getStreamPosition()); }
@Override public final void mark(int pLimit) { mark(); // TODO: We don't really need to do this.. Is it a good idea? try { flushBefore(Math.max(position - pLimit, flushedPosition)); } catch (IOException ignore) { // Ignore, as it's not really critical } }
@Override public final void mark(int pLimit) { mark(); // TODO: We don't really need to do this.. Is it a good idea? try { flushBefore(Math.max(mPosition - pLimit, mFlushedPosition)); } catch (IOException ignore) { // Ignore, as it's not really critical } }
protected static void markReset(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 10; i++) { pSeekable.mark(); System.out.println(new String(FileUtil.read(pSeekable))); pSeekable.reset(); } System.out.println(); System.out.println("mark/reset ok!"); }
protected static void markReset(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 10; i++) { pSeekable.mark(); System.out.println(new String(FileUtil.read(pSeekable))); pSeekable.reset(); } System.out.println(); System.out.println("mark/reset ok!"); }
protected static void timeRead(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 5000; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long start = System.currentTimeMillis(); final int times = 200000; for (int i = 0; i < times; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long time = System.currentTimeMillis() - start; System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)"); }
protected static void timeRead(SeekableInputStream pSeekable) throws IOException { for (int i = 0; i < 5000; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long start = System.currentTimeMillis(); final int times = 200000; for (int i = 0; i < times; i++) { pSeekable.mark(); FileUtil.read(pSeekable); pSeekable.reset(); } long time = System.currentTimeMillis() - start; System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)"); }
public void testMarkFlushReset() throws Exception { SeekableInputStream seekable = makeInputStream(77); seekable.mark(); int position = 55; seekable.seek(position); seekable.flushBefore(position); try { seekable.reset(); fail("Reset before flushed position succeeded"); } catch (IOException e) { // Ignore } assertEquals(position, seekable.getStreamPosition()); }
@Test public void testMarkFlushReset() throws Exception { SeekableInputStream seekable = makeInputStream(77); seekable.mark(); int position = 55; seekable.seek(position); seekable.flushBefore(position); try { seekable.reset(); fail("Reset before flushed position succeeded"); } catch (IOException e) { // Ignore } assertEquals(position, seekable.getStreamPosition()); }