|
@@ -4,6 +4,7 @@ import com.qmth.boot.tools.codec.CodecUtils;
|
|
import com.qmth.boot.tools.io.IOUtils;
|
|
import com.qmth.boot.tools.io.IOUtils;
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
+import java.net.URL;
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
@@ -27,6 +28,16 @@ public class ByteArray {
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据URL初始化
|
|
|
|
+ *
|
|
|
|
+ * @param url
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static ByteArray fromUrl(String url) throws IOException {
|
|
|
|
+ return ByteArray.fromInputStream(new URL(url).openStream());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据输入流初始化
|
|
* 根据输入流初始化
|
|
*
|
|
*
|