Modifier and Type | Field and Description |
---|---|
protected static Map<String,FilePool> |
pools
公共FilePool的缓存池
|
Constructor and Description |
---|
NutFilePool(String homePath) |
NutFilePool(String homePath,
long size) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
清空文件池
|
static void |
clearPools() |
File |
createDir()
在池中创建一个临时目录
|
File |
createFile(String suffix)
在池中创建一个文件
|
long |
current() |
File |
getDir(long fId)
获取一个临时目录,如果临时目录不存在,返回null
|
File |
getFile(long fId,
String suffix)
获取一个文件,如果文件不存在,返回null
|
long |
getFileId(File f)
获取一个文件在池中的 ID。 如果这个文件不在池中,返回 -1
|
static FilePool |
getOrCreatePool(String path,
long limit)
获取指定路径下的FilePool,如果没有就新建一个
|
boolean |
hasDir(long fId)
判断文件池中是否存在一个临时目录
|
boolean |
hasFile(long fId,
String suffix)
判断文件池中是否存在一个文件
|
File |
removeDir(long fId)
从池中删除一个临时目录,如果文件不存在,返回null
|
File |
removeFile(long fId,
String suffix)
从池中删除一个文件,如果文件不存在,返回null
|
File |
returnDir(long fId)
获取一个临时目录,如果临时目录不存在,创建它
|
File |
returnFile(long fId,
String suffix)
获取一个文件,如果文件不存在,创建它
|
public NutFilePool(String homePath)
public NutFilePool(String homePath, long size)
public void clear()
FilePool
public File createFile(String suffix)
FilePool
createFile
in interface FilePool
suffix
- 文件的后缀public long getFileId(File f)
FilePool
public File removeFile(long fId, String suffix)
FilePool
removeFile
in interface FilePool
fId
- 文件IDsuffix
- 文件后缀名public boolean hasFile(long fId, String suffix)
FilePool
public File getFile(long fId, String suffix)
FilePool
public File returnFile(long fId, String suffix)
FilePool
returnFile
in interface FilePool
public File removeDir(long fId)
FilePool
public boolean hasDir(long fId)
FilePool
public File getDir(long fId)
FilePool
public File returnDir(long fId)
FilePool
public static FilePool getOrCreatePool(String path, long limit)
path
- 临时文件夹limit
- 最大文件数量public static void clearPools()
Copyright © 2017. All rights reserved.