From 603cb36a5123e46656b06a5deb8d7ac7ff81307f Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期三, 25 十二月 2019 08:48:51 +0800 Subject: [PATCH] a --- app/src/main/java/com/basic/security/utils/FastDFSUtil.java | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/basic/security/utils/FastDFSUtil.java b/app/src/main/java/com/basic/security/utils/FastDFSUtil.java index 4c3e96d..a924aee 100644 --- a/app/src/main/java/com/basic/security/utils/FastDFSUtil.java +++ b/app/src/main/java/com/basic/security/utils/FastDFSUtil.java @@ -43,8 +43,8 @@ byte[] by = getBytes(fdfs_client_path); String fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.length()); String resultPath = uploadFile(by, fileName, type); -// System.out.println(TAG + "涓婁紶鍚庣浉瀵瑰瓨鍌ㄨ矾寰勶細" + resultPath); -// System.out.println("璁块棶璺緞锛�"+PropertiesUtils.getInfo("fastdfs_url")+resultPath); +// System1.out.println(TAG + "涓婁紶鍚庣浉瀵瑰瓨鍌ㄨ矾寰勶細" + resultPath); +// System1.out.println("璁块棶璺緞锛�"+PropertiesUtils.getInfo("fastdfs_url")+resultPath); } catch (Exception e) { e.printStackTrace(); } @@ -58,7 +58,7 @@ return uploadFile(data, fileName, "jpg"); } catch (Exception e) { // e.printStackTrace(); - System.out.println("FastDFSUtil.upLoadVisitorPic " + e.getMessage()); + System1.out.println("FastDFSUtil.upLoadVisitorPic " + e.getMessage()); return null; } } @@ -97,43 +97,43 @@ String path; TrackerServer trackerServer = null; try { -// System.out.println(TAG + "涓婁紶鏂囦欢鍚�:" + name); +// System1.out.println(TAG + "涓婁紶鏂囦欢鍚�:" + name); // if (!getInfo("file_type_list").contains(ext) // && !getInfo("file_type_list").toUpperCase().contains(ext)) { -// System.out.println("涓嶆敮鎸�" + ext + "绫诲瀷鏂囦欢涓婁紶!"); +// System1.out.println("涓嶆敮鎸�" + ext + "绫诲瀷鏂囦欢涓婁紶!"); // throw new RuntimeException("涓嶆敮鎸�" + ext + "绫诲瀷鏂囦欢涓婁紶!"); // } -// System.out.println(TAG + "涓婁紶鏂囦欢绫诲瀷: " + ext); +// System1.out.println(TAG + "涓婁紶鏂囦欢绫诲瀷: " + ext); if (pic.length / 1024 / 1024 > 10) { -// System.out.println(TAG + "浠呮敮鎸�10MB浠ヤ笅鏂囦欢涓婁紶!"); +// System1.out.println(TAG + "浠呮敮鎸�10MB浠ヤ笅鏂囦欢涓婁紶!"); throw new RuntimeException(TAG + "浠呮敮鎸�10MB浠ヤ笅鏂囦欢涓婁紶!"); } -// System.out.println(TAG + "鏂囦欢澶у皬:" + pic.length / 1024 + "KB"); +// System1.out.println(TAG + "鏂囦欢澶у皬:" + pic.length / 1024 + "KB"); String fdfs_client_path = new ContextWrapper(BaseApplication.getApplication().activity).getFilesDir().getAbsolutePath(); ClientGlobal.init(fdfs_client_path + "/fdfs_client.properties"); TrackerClient trackerClient = new TrackerClient(); trackerServer = trackerClient.getConnection(); -// System.out.println(TAG + "tracker鏈嶅姟鍣ㄨ繛鎺ユ垚鍔�! " + trackerServer.getInetSocketAddress()); +// System1.out.println(TAG + "tracker鏈嶅姟鍣ㄨ繛鎺ユ垚鍔�! " + trackerServer.getInetSocketAddress()); StorageServer storageServer = null; StorageClient1 storageClient1 = new StorageClient1(trackerServer, storageServer); -// System.out.println(TAG + "鍚姩FastDFS瀹㈡埛绔�.... 锛�" + storageClient1); +// System1.out.println(TAG + "鍚姩FastDFS瀹㈡埛绔�.... 锛�" + storageClient1); NameValuePair[] meta_list = new NameValuePair[3]; meta_list[0] = new NameValuePair("filename", name); meta_list[1] = new NameValuePair("fileext", ext); meta_list[2] = new NameValuePair("filesize", String.valueOf(pic.length)); path = storageClient1.upload_file1(pic, ext, meta_list); if (null != path && !"".equals(path)) { -// System.out.println(TAG + "鏂囦欢涓婁紶鎴愬姛! " + path); +// System1.out.println(TAG + "鏂囦欢涓婁紶鎴愬姛! " + path); return path; } else { -// System.out.println(TAG + "鏂囦欢涓婁紶澶辫触锛�"); +// System1.out.println(TAG + "鏂囦欢涓婁紶澶辫触锛�"); throw new RuntimeException(TAG + "鏂囦欢涓婁紶澶辫触锛�"); } } catch (Exception e) { // e.printStackTrace(); -// System.out.println(TAG + "绯荤粺寮傚父锛屾枃浠朵笂浼犲け璐ワ紒"); +// System1.out.println(TAG + "绯荤粺寮傚父锛屾枃浠朵笂浼犲け璐ワ紒"); // throw new RuntimeException(TAG + "绯荤粺寮傚父锛屾枃浠朵笂浼犲け璐ワ紒" + e.getMessage()); - System.out.println("FastDFSUtil.uploadFile " + e.getMessage()); + System1.out.println("FastDFSUtil.uploadFile " + e.getMessage()); } finally { if (trackerServer != null) { try { @@ -156,7 +156,7 @@ @SuppressWarnings("unused") public static String downFile(String fileUrl) { if (null == fileUrl || "".equals(fileUrl)) { -// System.out.println("涓嬭浇鏂囦欢婧愯矾寰勪负绌猴紒"); +// System1.out.println("涓嬭浇鏂囦欢婧愯矾寰勪负绌猴紒"); return null; } BufferedInputStream dis = null; @@ -166,14 +166,14 @@ // 瀛樺偍涓嬭浇鏂囦欢鐨勮矾寰�,榛樿瀛樺偍鍦ㄥ綋鍓嶇敤鎴锋墍鍦ㄧ洰褰曚笅 filePath = System.getProperty("user.home") + File.separator + fileUrl.substring(fileUrl.lastIndexOf("/") + 1); -// System.out.println("鏈湴瀛樺偍璺緞:" + filePath); +// System1.out.println("鏈湴瀛樺偍璺緞:" + filePath); File destFile = new File(filePath); if (!destFile.exists()) { destFile.createNewFile(); } URL url = new URL(getInfo("http_head") + getInfo("fastdfs_vip") + fileUrl); -// System.out.println("鏂囦欢婧愯矾寰�:" + url); +// System1.out.println("鏂囦欢婧愯矾寰�:" + url); dis = new BufferedInputStream(url.openStream()); fos = new BufferedOutputStream(new FileOutputStream(destFile)); byte[] buff = new byte[2048]; @@ -181,9 +181,9 @@ while (-1 != (bytesRead = dis.read(buff, 0, buff.length))) { fos.write(buff, 0, bytesRead); } -// System.out.println("鏂囦欢涓嬭浇鎴愬姛!"); +// System1.out.println("鏂囦欢涓嬭浇鎴愬姛!"); } catch (Exception e) { -// System.out.println("鏂囦欢涓嬭浇鍑虹幇鏈煡寮傚父!"); +// System1.out.println("鏂囦欢涓嬭浇鍑虹幇鏈煡寮傚父!"); return null; } finally { if (dis != null) { -- Gitblit v1.8.0