|
TrueZIP Kernel 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.socket.IOCache
@ThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class IOCache
Provides temporary caching services for input and output sockets with the following features:
cleared.
IOCache.Strategy, entry data written to the
cache may not be written to the backing store until the cache gets
flushed.
cleared.
| Nested Class Summary | |
|---|---|
private class |
IOCache.Buffer
|
private static class |
IOCache.CacheEntry
Proxies the decorated entry to hide socket connections. |
private class |
IOCache.CacheInputSocket
|
private class |
IOCache.CacheOutputSocket
|
private class |
IOCache.InputBufferPool
|
private static class |
IOCache.Lock
|
private class |
IOCache.OutputBufferPool
|
static class |
IOCache.Strategy
Provides different cache strategies. |
private class |
IOCache.WriteBackOutputBufferPool
|
private class |
IOCache.WriteThroughOutputBufferPool
|
| Field Summary | |
|---|---|
private IOCache.Buffer |
buffer
|
private InputSocket<?> |
input
|
private IOCache.InputBufferPool |
inputBufferPool
|
private IOCache.Lock |
lock
|
private OutputSocket<?> |
output
|
private IOCache.OutputBufferPool |
outputBufferPool
|
private IOPool<?> |
pool
|
private IOCache.Strategy |
strategy
|
| Constructor Summary | |
|---|---|
private |
IOCache(IOCache.Strategy strategy,
IOPool<?> pool)
Constructs a new cache which applies the given caching strategy and uses the given pool to allocate and release temporary I/O entries. |
| Method Summary | |
|---|---|
IOCache |
clear()
Discards the entry data in this buffer. |
IOCache |
configure(InputSocket<?> input)
Configures the input socket for reading the entry data from the backing store. |
IOCache |
configure(OutputSocket<?> output)
Configures the output socket for writing the entry data to the backing store. |
protected void |
finalize()
|
IOCache |
flush()
Writes the cached entry data to the backing store unless already done. |
private IOCache.Buffer |
getBuffer()
|
Entry |
getEntry()
|
private IOCache.InputBufferPool |
getInputBufferPool()
|
InputSocket<?> |
getInputSocket()
Returns an input socket for reading the cached entry data. |
private IOCache.OutputBufferPool |
getOutputBufferPool()
|
OutputSocket<?> |
getOutputSocket()
Returns an output socket for writing the cached entry data. |
private void |
setBuffer(IOCache.Buffer newBuffer)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final IOCache.Lock lock
private final IOCache.Strategy strategy
private final IOPool<?> pool
@Nullable private volatile InputSocket<?> input
@Nullable private volatile OutputSocket<?> output
@CheckForNull private volatile IOCache.InputBufferPool inputBufferPool
@CheckForNull private volatile IOCache.OutputBufferPool outputBufferPool
@CheckForNull private volatile IOCache.Buffer buffer
| Constructor Detail |
|---|
private IOCache(IOCache.Strategy strategy,
IOPool<?> pool)
Note that you need to call configure(InputSocket) before
you can do any input.
Likewise, you need to call configure(OutputSocket) before
you can do any output.
strategy - the caching strategy.pool - the pool for allocating and releasing temporary I/O entries.| Method Detail |
|---|
public IOCache configure(InputSocket<?> input)
NullPointerException will be thrown on the first
read attempt.
Note that calling this method does not clear
this cache.
input - an input socket for reading the entry data from the
backing store.
public IOCache configure(OutputSocket<?> output)
NullPointerException will be thrown on the first
write attempt.
Note that calling this method does not flush
this cache.
output - an output socket for writing the entry data to the
backing store.
public IOCache flush()
throws IOException
IOCache.Strategy.WRITE_THROUGH writes any
changed entry data immediately, so calling this method has no effect.
IOException
public IOCache clear()
throws IOException
IOException@Nullable public Entry getEntry()
public InputSocket<?> getInputSocket()
public OutputSocket<?> getOutputSocket()
private IOCache.InputBufferPool getInputBufferPool()
private IOCache.OutputBufferPool getOutputBufferPool()
@CheckForNull private IOCache.Buffer getBuffer()
private void setBuffer(@CheckForNull
IOCache.Buffer newBuffer)
throws IOException
IOException
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
TrueZIP Kernel 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||