YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.share.DeleteOnCloseSource Class Reference

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...

Inheritance diagram for de.yaacc.share.DeleteOnCloseSource:
Inheritance graph
Collaboration diagram for de.yaacc.share.DeleteOnCloseSource:
Collaboration graph

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DeleteOnCloseSource()

de.yaacc.share.DeleteOnCloseSource.DeleteOnCloseSource ( PositionalSource delegate,
File file )
Parameters
delegatethe source that reads the copy
filethe copy to delete
Exceptions
IllegalArgumentExceptionif an argument is null
Here is the call graph for this function:

Member Function Documentation

◆ closeInternal()

void de.yaacc.share.DeleteOnCloseSource.closeInternal ( )
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.

Here is the call graph for this function:

◆ readAtInternal()

int de.yaacc.share.DeleteOnCloseSource.readAtInternal ( long position,
byte[] buf,
int off,
int len ) throws IOException
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.

Here is the call graph for this function:

The documentation for this class was generated from the following file: