|
YAACC - UPNP Client and Server
|
The registered source of a copied file: reads go to the wrapped source, and when this source is really closed (never while a read runs, see PositionalSource) the wrapped source is closed first and then the copy is deleted, so a copy never outlives its share.
More...


Public Member Functions | |
| DeleteOnCloseSource (PositionalSource delegate, File file) | |
Public Member Functions inherited from de.yaacc.share.PositionalSource | |
| final long | size () |
| final int | readAt (long position, byte[] buf, int off, int len) throws IOException |
Reads up to len bytes starting at position. | |
| final boolean | isClosing () |
| final void | close () |
| Refuses new reads and closes the backend: now if nothing is reading, else when the last running read ends. | |
Protected Member Functions | |
| int | readAtInternal (long position, byte[] buf, int off, int len) throws IOException |
| Reads from the backend. | |
| void | closeInternal () |
| Closes the backend. | |
Protected Member Functions inherited from de.yaacc.share.PositionalSource | |
| PositionalSource (long size) | |
The registered source of a copied file: reads go to the wrapped source, and when this source is really closed (never while a read runs, see PositionalSource) the wrapped source is closed first and then the copy is deleted, so a copy never outlives its share.
Plain Java.
| de.yaacc.share.DeleteOnCloseSource.DeleteOnCloseSource | ( | PositionalSource | delegate, |
| File | file ) |
| delegate | the source that reads the copy |
| file | the copy to delete |
| IllegalArgumentException | if an argument is null |

|
protected |
Closes the backend.
Called exactly once, never while a read is running, possibly on a reader's thread. Should not throw; an exception is swallowed.
Reimplemented from de.yaacc.share.PositionalSource.

|
protected |
Reads from the backend.
Called with 0 <= position < size(), len > 0 and a valid buffer range; possibly from several threads at once; never after the backend was closed. May return fewer bytes than asked. Returns -1 (or 0) if the backend has no more data at that position.
Reimplemented from de.yaacc.share.PositionalSource.
