@Test public void expiration() throws Exception { StreamCache streamCache = new StreamCache(0); FileInStream is = mock(FileInStream.class); FileOutStream os = mock(FileOutStream.class); streamCache.put(is); streamCache.put(os); verify(is).close(); verify(os).close(); }
public Integer put(FileInStream is) { int id = mCounter.incrementAndGet(); mInStreamCache.put(id, is); return id; }
StreamCache { public Integer put(FileInStream is) { int id = mCounter.incrementAndGet(); mInStreamCache.put(id, is); return id; } }
StreamCache { public Integer put(FileInStream is) { int id = mCounter.incrementAndGet(); mInStreamCache.put(id, is); return id; } StreamCache(long timeoutMs); }
StreamCache { public Integer put(FileInStream is) { int id = mCounter.incrementAndGet(); mInStreamCache.put(id, is); return id; } StreamCache(long timeoutMs); FileInStream getInStream(Integer key); FileOutStream getOutStream(Integer key); Integer put(FileInStream is); Integer put(FileOutStream os); @Nullable Closeable invalidate(Integer key); long size(); }
StreamCache { public Integer put(FileInStream is) { int id = mCounter.incrementAndGet(); mInStreamCache.put(id, is); return id; } StreamCache(long timeoutMs); FileInStream getInStream(Integer key); FileOutStream getOutStream(Integer key); Integer put(FileInStream is); Integer put(FileOutStream os); @Nullable Closeable invalidate(Integer key); long size();  }