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

The app's cache/incoming/ directory, where copies of provider files that cannot seek are kept for the time of a share. More...

Collaboration diagram for de.yaacc.share.IncomingCache:
Collaboration graph

Static Public Member Functions

static int sweep (File dir)
 Deletes the leftovers of an earlier run (the registry is in memory, so no copy survives a process).
 
static long totalBytes (File dir)
 
static long remainingCopyBudget (File dir)
 How many bytes one more copy may have: the per-file cap, reduced so that all copies together stay within ShareLimits#INCOMING_DIR_MAX_BYTES.
 
static File createCopyFile (File dir, Consumer< byte[]> randomBytes) throws IOException
 Creates a new, empty file with a random name in the directory (created if needed).
 

Static Public Attributes

static final String DIR_NAME = "incoming"
 The directory name below the cache directory.
 

Detailed Description

The app's cache/incoming/ directory, where copies of provider files that cannot seek are kept for the time of a share.

Plain Java (java.io/java.nio.file only), so it is tested on the JVM with a temporary folder.

The directory is private to the app, but it is still treated carefully: only entries that are regular files with exactly the shape of IncomingFileNames#randomName are ever deleted, symbolic links and directories are never followed, opened or deleted, and names never come from the provider.

Member Function Documentation

◆ createCopyFile()

static File de.yaacc.share.IncomingCache.createCopyFile ( File dir,
Consumer< byte[]> randomBytes ) throws IOException
static

Creates a new, empty file with a random name in the directory (created if needed).

Exceptions
IOExceptionif no file could be created

Referenced by de.yaacc.share.SharedFileOpener.copyAndHold().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remainingCopyBudget()

static long de.yaacc.share.IncomingCache.remainingCopyBudget ( File dir)
static

How many bytes one more copy may have: the per-file cap, reduced so that all copies together stay within ShareLimits#INCOMING_DIR_MAX_BYTES.

Returns
0 or more; 0 means the directory is full

Referenced by de.yaacc.share.SharedFileOpener.copyAndHold().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sweep()

static int de.yaacc.share.IncomingCache.sweep ( File dir)
static

Deletes the leftovers of an earlier run (the registry is in memory, so no copy survives a process).

Never throws.

Returns
the number of files deleted
Here is the call graph for this function:

◆ totalBytes()

static long de.yaacc.share.IncomingCache.totalBytes ( File dir)
static
Returns
the size of all regular files directly in the directory (links and directories are not counted or followed), 0 if it does not exist; never throws

Referenced by de.yaacc.share.IncomingCache.remainingCopyBudget().

Here is the caller graph for this function:

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