Bladeren bron

【CHG】调整一次读取图片数据量

ZhaoMn 4 jaren geleden
bovenliggende
commit
31e2d33483
2 gewijzigde bestanden met toevoegingen van 21 en 21 verwijderingen
  1. 1 1
      pom.xml
  2. 20 20
      railway-common/src/main/java/com/railway/common/utils/http/HttpUtils.java

+ 1 - 1
pom.xml

@@ -9,7 +9,7 @@
   <version>1.0.0</version>
 
   <name>railway</name>
-  <description>管理系统</description>
+  <description>供电生产管理系统</description>
   <packaging>pom</packaging>
 
   <modules>

+ 20 - 20
railway-common/src/main/java/com/railway/common/utils/http/HttpUtils.java

@@ -129,25 +129,6 @@ public class HttpUtils {
     }
     return null;
   }
-
-  /**
-   * 获取重定向地址
-   * @param path 原URL地址
-   * @return 重定向之后的地址
-   * @throws Exception 读写异常
-   */
-  private static String getRedirectUrl(String path) throws Exception {
-    HttpURLConnection conn = (HttpURLConnection) new URL(path)
-        .openConnection();
-    conn.setInstanceFollowRedirects(false);
-    conn.setConnectTimeout(5000);
-    String redirectUrl = conn.getHeaderField("Location");
-    if(null == redirectUrl){
-      redirectUrl = path;
-    }
-    return redirectUrl;
-  }
-
   /**
    * 向指定 URL 发送POST方法的请求
    *
@@ -250,12 +231,31 @@ public class HttpUtils {
     return result.toString();
   }
 
+  /**
+   * 获取重定向地址
+   * @param path 原URL地址
+   * @return 重定向之后的地址
+   * @throws Exception 读写异常
+   */
+  private static String getRedirectUrl(String path) throws Exception {
+    HttpURLConnection conn = (HttpURLConnection) new URL(path)
+        .openConnection();
+    conn.setInstanceFollowRedirects(false);
+    conn.setConnectTimeout(5000);
+    String redirectUrl = conn.getHeaderField("Location");
+    if(null == redirectUrl){
+      redirectUrl = path;
+    }
+    return redirectUrl;
+  }
+
+
   /**
    * 将输入流中的数据写入字节数组
    */
   public static byte[] inputStream2ByteArray(InputStream in) {
     List<Byte> byteList = new ArrayList<>();
-    byte[] bytes = new byte[2048];
+    byte[] bytes = new byte[102400];
     try {
       while (in.read(bytes) != -1) {
         byteList.addAll(Bytes.asList(bytes));