public class FastDFSClient extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
fileServerAddr
The file server address
|
protected static int |
maxFileSize
The max file size
|
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
deleteFile(String filepath)
Delete file from fastdfs by file path
|
static void |
download(String filepath,
javax.servlet.http.HttpServletResponse response)
Download file
|
static void |
download(String filepath,
String filename,
javax.servlet.http.HttpServletResponse response)
Download file
|
static Map<String,String> |
getFileDescriptions(String filepath)
Get the file descriptions from fastdfs
|
static org.csource.fastdfs.FileInfo |
getFileInfo(String filepath)
获取文件信息
|
static String |
getFileServerAddr()
Get the file server address
|
static String |
getToken(String filepath,
String httpSecretKey)
Get token to access the server and concatenate it after the address
|
static String |
info()
The client information
|
static String |
upload(InputStream is)
Upload
|
static String |
upload(InputStream is,
String filename)
Upload
|
static String |
upload(InputStream is,
String filename,
Map<String,String> descriptions)
Upload
|
static String |
uploadWithBase64(String base64)
Upload with base64 string
|
static String |
uploadWithBase64(String base64,
String filename)
Upload with base64 string
|
static String |
uploadWithBase64(String base64,
String filename,
Map<String,String> descriptions)
Upload with base64 string
|
static String |
uploadWithFilepath(String filepath)
Upload with file path
|
static String |
uploadWithFilepath(String filepath,
Map<String,String> descriptions)
Upload with file path
|
static String |
uploadWithMultipart(org.springframework.web.multipart.MultipartFile file)
Upload with MultipartFile
|
static String |
uploadWithMultipart(org.springframework.web.multipart.MultipartFile file,
Map<String,String> descriptions)
Upload with MultipartFile
|
static void |
write(String filepath,
OutputStream os)
Write file
|
protected static int maxFileSize
protected static String fileServerAddr
public static String uploadWithMultipart(org.springframework.web.multipart.MultipartFile file)
file - the multipart filegroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithMultipart(org.springframework.web.multipart.MultipartFile file, Map<String,String> descriptions)
file - the multipart filedescriptions - the file descriptionsgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithFilepath(String filepath)
filepath - the file pathgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithFilepath(String filepath, Map<String,String> descriptions)
filepath - the file pathdescriptions - the file descriptionsgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithBase64(String base64)
base64 - the base64 stringgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithBase64(String base64, String filename)
base64 - the base64 stringfilename - the file namegroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String uploadWithBase64(String base64, String filename, Map<String,String> descriptions)
base64 - the base64 stringfilename - the file namedescriptions - the file descriptionsgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String upload(InputStream is)
is - the file input streamgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String upload(InputStream is, String filename)
is - the file input streamfilename - the file namegroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static String upload(InputStream is, String filename, Map<String,String> descriptions)
is - the file input streamfilename - the file namedescriptions - the file descriptionsgroup1/M00/00/00/wKgDwFv-MoSAAvKrAAUC5Uh8n8c53.jpegpublic static void download(String filepath, javax.servlet.http.HttpServletResponse response)
filepath - the fastdfs file pathresponse - the http servlet responsepublic static void download(String filepath, String filename, javax.servlet.http.HttpServletResponse response)
filepath - the fastdfs file pathfilename - the download file nameresponse - the http servlet responsepublic static void write(String filepath, OutputStream os)
filepath - the fastdfs file pathos - the output streampublic static int deleteFile(String filepath)
filepath - the fastdfs file pathpublic static org.csource.fastdfs.FileInfo getFileInfo(String filepath)
filepath - 文件路径
{
"SourceIpAddr": 源IP
"FileSize": 文件大小
"CreateTime": 创建时间
"CRC32": 签名
}
public static String getToken(String filepath, String httpSecretKey)
filepath - the fastdfs file pathhttpSecretKey - the http secret keypublic static Map<String,String> getFileDescriptions(String filepath)
filepath - the fastdfs file pathpublic static String getFileServerAddr()
public static String info()
Copyright © 2018. All rights reserved.