{"id":486,"date":"2017-09-18T15:46:48","date_gmt":"2017-09-18T07:46:48","guid":{"rendered":"https:\/\/www.dd-home.top\/?p=486"},"modified":"2017-09-18T15:46:48","modified_gmt":"2017-09-18T07:46:48","slug":"%e7%b1%bb%e5%8a%a0%e8%bd%bd%e5%99%a8%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%b9%b6%e8%bd%ac%e6%8d%a2%e6%88%90%e6%b5%81","status":"publish","type":"post","link":"https:\/\/www.dd-home.top\/?p=486","title":{"rendered":"\u7c7b\u52a0\u8f7d\u5668\u83b7\u53d6\u6587\u4ef6\u5e76\u8f6c\u6362\u6210\u6d41"},"content":{"rendered":"<p><!--more--><\/p>\n<pre>public class ByteUtils {\n    private static byte[] dataPre = null;\n    static {\n        try {\n            dataPre = getDataFile(new File(ByteUtils.class.getResource(\"icon-img.jpg\").toURI()));\n        } catch (URISyntaxException e) {\n            e.printStackTrace();\n        }\n    }\n    public static ByteArrayOutputStream getDate(byte[] data) {\n        ByteArrayOutputStream baos = null;\n        if (data == null) {\n            data = dataPre;\n        }\n        try {\n            baos = new ByteArrayOutputStream();\n            baos.write(Base64.encodeBase64(data));\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return baos;\n    }\n\n    public static byte[] getDataFile(File file) {\n        if (null != file) {\n            byte[] bFile = new byte[(int) file.length()];\n            try {\n                FileInputStream fileInputStream = new FileInputStream(file);\n                fileInputStream.read(bFile);\n                fileInputStream.close();\n            } catch (Exception e) {\n                e.printStackTrace();\n            }\n            return bFile;\n        }\n        return null;\n    }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-486","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.dd-home.top\/index.php?rest_route=\/wp\/v2\/posts\/486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dd-home.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dd-home.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dd-home.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dd-home.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=486"}],"version-history":[{"count":0,"href":"https:\/\/www.dd-home.top\/index.php?rest_route=\/wp\/v2\/posts\/486\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dd-home.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dd-home.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dd-home.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}