|
@ -1,16 +1,21 @@
|
|
|
package cn.stylefeng.guns.zjxlUtil;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import org.csource.common.MyException;
|
|
|
import org.csource.common.NameValuePair;
|
|
|
import org.csource.fastdfs.*;
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
|
|
import cn.stylefeng.guns.zjxlUtil.FastDFSClientPool;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import org.csource.common.MyException;
|
|
|
import org.csource.common.NameValuePair;
|
|
|
import org.csource.fastdfs.ClientGlobal;
|
|
|
import org.csource.fastdfs.ProtoCommon;
|
|
|
import org.csource.fastdfs.StorageClient;
|
|
|
import org.csource.fastdfs.StorageClient1;
|
|
|
import org.csource.fastdfs.TrackerServer;
|
|
|
|
|
|
/**
|
|
|
* FastDFS 客户端工具.
|
|
|
*
|
|
@ -76,7 +81,7 @@ public class FastDFSUtil {
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public ObjectNode upload(InputStream in, String fileExtension,
|
|
|
public static ObjectNode upload(InputStream in, String fileExtension,
|
|
|
String description) throws Exception {
|
|
|
StorageClient client = FastDFSClientPool.getInstance().getStorageClient();
|
|
|
try {
|
|
@ -127,7 +132,7 @@ public class FastDFSUtil {
|
|
|
}
|
|
|
|
|
|
message.put(FileUrlField, fileURl);
|
|
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
} else {
|
|
@ -162,7 +167,7 @@ public class FastDFSUtil {
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public ObjectNode upload(String fileName, String description) throws Exception {
|
|
|
public static ObjectNode upload(String fileName, String description) throws Exception {
|
|
|
StorageClient client = FastDFSClientPool.getInstance().getStorageClient();
|
|
|
try {
|
|
|
NameValuePair[] meta_list;
|
|
@ -211,7 +216,7 @@ public class FastDFSUtil {
|
|
|
}
|
|
|
|
|
|
message.put(FileUrlField, fileUrl);
|
|
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
} else {
|