{"id":653,"date":"2019-09-08T01:01:21","date_gmt":"2019-09-07T17:01:21","guid":{"rendered":"http:\/\/47.101.202.111\/?p=653"},"modified":"2019-12-19T08:59:37","modified_gmt":"2019-12-19T00:59:37","slug":"java%e7%89%b9%e6%80%a7%e6%96%87%e4%bb%b6%e6%93%8d%e4%bd%9cfile%e4%b8%8e%e8%af%bb%e5%86%99io","status":"publish","type":"post","link":"http:\/\/139.196.114.170\/?p=653","title":{"rendered":"[java\u7279\u6027]\u6587\u4ef6\u64cd\u4f5cFile\u4e0e\u6587\u4ef6\u8bfb\u5199IO"},"content":{"rendered":"<h1>IO\u6838\u5fc3<\/h1>\n<p>IO\u64cd\u4f5c\u4e3b\u8981\u7c7b\u548c\u65b9\u6cd5\u4f4d\u4e8ejava.io.*<\/p>\n<pre><code>&gt; File\u7c7b                             \u6587\u4ef6\u64cd\u4f5c\n&gt; Serializable\u63a5\u53e3                 \u5bf9\u8c61\u5e8f\u5217\u5316\n&gt; InputStream\u62bd\u8c61\u7c7b                \u5b57\u8282\u8f93\u5165\u6d41\n&gt; OutputStream\u62bd\u8c61\u7c7b               \u5b57\u8282\u8f93\u51fa\u6d41\n&gt; Reader\u62bd\u8c61\u7c7b                     \u5b57\u7b26\u8bfb\u53d6\u6d41\n&gt; Writer\u62bd\u8c61\u7c7b                     \u5b57\u7b26\u5199\u5165\u6d41\n\n&gt; \u6587\u4ef6\u8bfb\u5199\u56db\u6b65\u6838\u5fc3\n1. \u521b\u5efaFile\u7c7b\u5bf9\u8c61\uff0c\u6307\u660e\u64cd\u4f5c\u8def\u5f84\n2. \u8f93\u5165\u8f93\u51fa\u6d41\u5b50\u7c7b\u5bf9\u8c61\u5b9e\u4f8b\u5316\n3. \u5185\u5bb9\u4ee5\u5b57\u8282\u5f62\u5f0f\u8bfb\u5199\u64cd\u4f5c\n4. \u5173\u95ed\u6d41\n<\/code><\/pre>\n<p>[toc]<\/p>\n<h1>File\u7c7b<\/h1>\n<pre lang=\"java\">\npublic class File extends Object\nimplements Serializable, Comparable<File>               \/\/ \u53ef\u5e8f\u5217\u5316\u53ef\u6392\u5e8f\n-----------------------------------------------------------------------------------\npublic static final String separator                \/\/ \u7cfb\u7edf\u76f8\u5173\u7684\u8def\u5f84\u5206\u9694\u7b26\n-----------------------------------------------------------------------------------\npublic File (String pathname)                       \/\/ \u6784\u9020\u64cd\u4f5c\u8def\u5f84\u7684\u6587\u4ef6\u5bf9\u8c61\npublic File (URI uri)                               \/\/ \u6784\u9020\u64cd\u4f5c\u8def\u5f84\u7684\u6587\u4ef6\u5bf9\u8c61\npublic File (File parent, String child)     \/\/ \u901a\u8fc7\u7236\u8def\u5f84\u548c\u5b50\u8def\u5f84\u6784\u9020\u6587\u4ef6\u5bf9\u8c61\npublic File (String parent, String child)   \/\/ \u901a\u8fc7\u7236\u8def\u5f84\u548c\u5b50\u8def\u5f84\u6784\u9020\u6587\u4ef6\u5bf9\u8c61\n-----------------------------------------------------------------------------------\npublic boolean canExecute ()                            \/\/ \u5224\u65ad\u5f53\u524d\u6587\u4ef6\u53ef\u6267\u884c\npublic boolean canRead ()                               \/\/ \u5224\u65ad\u5f53\u524d\u6587\u4ef6\u53ef\u8bfb\npublic boolean canWrite ()                              \/\/ \u5224\u65ad\u5f53\u524d\u6587\u4ef6\u53ef\u5199\npublic boolean createNewFile () throws IOException          \/\/ \u521b\u5efa\u65b0\u6587\u4ef6\npublic boolean delete ()                                    \/\/ \u5220\u9664\u6587\u4ef6\npublic boolean exists ()                                    \/\/ \u5224\u65ad\u6587\u4ef6\u5b58\u5728\npublic File getAbsoluteFile ()                      \/\/ \u83b7\u53d6\u7edd\u5bf9\u8def\u5f84\u6587\u4ef6\u5b9e\u4f8b\npublic String getAbsolutePath ()                    \/\/ \u83b7\u53d6\u7edd\u5bf9\u8def\u5f84\u5b57\u7b26\u4e32\npublic String getName ()                                \/\/ \u83b7\u53d6\u6587\u4ef6\u6216\u76ee\u5f55\u540d\npublic String getParent ()                              \/\/ \u83b7\u53d6\u7236\u8def\u5f84\u5b57\u7b26\u4e32\npublic File getParentFile ()                            \/\/ \u83b7\u53d6\u7236\u8def\u5f84\u6587\u4ef6\u5b9e\u4f8b\npublic String getPath ()                                \/\/ \u83b7\u53d6\u6587\u4ef6\u8def\u5f84\npublic boolean isDirectory ()                       \/\/ \u5224\u65ad\u5f53\u524d\u8def\u5f84\u662f\u5426\u4e3a\u76ee\u5f55\npublic boolean isFile ()                            \/\/ \u5224\u65ad\u5f53\u524d\u6587\u4ef6\u662f\u5426\u4e3a\u6587\u4ef6\npublic long lastModified ()                         \/\/ \u83b7\u53d6\u6700\u540e\u4fee\u6539\u65f6\u95f4\uff08\u5355\u4f4dms\uff09\npublic long length ()                               \/\/ \u83b7\u53d6\u6587\u4ef6\u5927\u5c0f\uff08\u5355\u4f4dbyte\uff09\npublic String[] list ()                             \/\/ \u5217\u51fa\u6240\u5728\u8def\u5f84\u6240\u6709\u6587\u4ef6\u540d\u79f0\npublic File[] listFiles ()                          \/\/ \u5217\u51fa\u6240\u5728\u8def\u5f84\u6240\u6709\u6587\u4ef6\u5bf9\u8c61\npublic boolean mkdir ()                         \/\/ \u7236\u76ee\u5f55\u6587\u4ef6\u5bf9\u8c61\u521b\u5efa\u5355\u7ea7\u76ee\u5f55\npublic boolean mkdirs ()                        \/\/ \u7236\u76ee\u5f55\u6587\u4ef6\u5bf9\u8c61\u521b\u5efa\u591a\u7ea7\u76ee\u5f55\npublic boolean renameTo (File dest)                 \/\/ \u6587\u4ef6\u91cd\u547d\u540d\u548c\u66f4\u6539\u8def\u5f84\n<\/pre>\n<h4>\u521b\u5efa\u6587\u4ef6\u5bf9\u8c61<\/h4>\n<p>File.separator\u53ef\u5b9e\u73b0\u6587\u4ef6\u5206\u9694\u7b26\u7684\u8de8\u5e73\u53f0\u517c\u5bb9\u6027<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\/directory\/file.txt\");\n    File file = new File(\"D:\/\/directory\/\/file.txt\");\n    File file = new File(\"D:\\\\directory\\\\file.txt\"); \/\/ \u5206\u9694\u7b26\u6ce8\u610f\u8f6c\u4e49\n    File file = new File(\"D:\" + File.separator + \"directory\"+ File.separator + \"file.txt\");\n    File file = new File(\"D:\", \"subFile.txt\");\n    File fileDir = new File(\"D:\" + File.separator + \"directory\");\n    File file = new File(fileDir, \"subFile.txt\");\n<\/code><\/pre>\n<h4>\u521b\u5efa\u78c1\u76d8\u6587\u4ef6<\/h4>\n<p>\u7236\u76ee\u5f55\u5b58\u5728\u524d\u63d0\u4e0b\u521b\u5efa\u78c1\u76d8\u6587\u4ef6\uff0c\u5426\u5219\u62a5IOException<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");    \/\/ \u6307\u5b9a\u64cd\u4f5c\u8def\u5f84\n    try { file.createNewFile(); }                   \/\/ \u9700\u5728\u5df2\u5b58\u5728\u7684\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6\n    catch (IOException e) { e.printStackTrace(); }\n    if (file.exists()) { System.out.println(file.delete()); }       \/\/ \u6587\u4ef6\u5220\u9664\n<\/code><\/pre>\n<p>\u672a\u77e5\u7236\u76ee\u5f55\u60c5\u51b5\u5e94\u52a0\u5165\u5b58\u5728\u5224\u65ad\u548c\u521b\u5efa\uff0c\u53ea\u9700\u5224\u65ad\u548c\u521b\u5efa\u4e00\u6b21\u4ee5\u63d0\u5347\u6027\u80fd<\/p>\n<pre><code class=\"language-java \">    private static File file = new File(\n              \"D:\"          + File.separator\n            + \"directory\"   + File.separator\n            + \"directory\"   + File.separator\n            + \"file.txt\");\n\n    \/\/ \u7236\u76ee\u5f55\u4e0d\u5b58\u5728\u521b\u5efa\u7236\u76ee\u5f55\n    static {\n        if (!file.getParentFile().exists()) {\n            file.getParentFile().mkdirs();\n        }\n    }\n\n    public static void main(String[] args) throws IOException {\n        if (!file.exists()) {\n            file.createNewFile();\n        }\n    }\n<\/code><\/pre>\n<p>\u6587\u4ef6\u64cd\u4f5c\u6d89\u53ca\u78c1\u76d8\u8bfb\u5199\uff0c\u5b58\u5728\u4e00\u5b9a\u7684\u5ef6\u8fdf<\/p>\n<h4>\u521b\u5efa\u6587\u4ef6\u76ee\u5f55<\/h4>\n<p>\u7236\u76ee\u5f55\u5b58\u5728\u53ef\u4f7f\u7528mkdir\u65b9\u6cd5\u5728\u7236\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u7ea7\u5b50\u76ee\u5f55<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"directory\");\n    if(!file.exists()){ file.mkdir(); }\n<\/code><\/pre>\n<p>\u7236\u76ee\u5f55\u5b58\u5728\u4e0e\u5426\u5747\u53ef\u4f7f\u7528mkdirs\u65b9\u6cd5\u4e00\u6b21\u6027\u521b\u5efa\u58f0\u660e\u7684\u6240\u6709\u76ee\u5f55<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator\n                + \"directory\" + File.separator\n                + \"directory\");\n    if(!file.exists()){ file.mkdirs(); }\n<\/code><\/pre>\n<h4>\u6587\u4ef6\u5c5e\u6027\u64cd\u4f5c<\/h4>\n<pre><code class=\"language-java \">    System.out.print(file.canRead());         \/\/ true\n    System.out.print(file.canWrite());        \/\/ true\n    System.out.print(file.canExecute());      \/\/ true\n    System.out.print(file.getName());         \/\/ file.txt\n    System.out.print(file.getPath());         \/\/ D:\\directory\\directory\\file.txt\n    System.out.print(file.getAbsoluteFile()); \/\/ D:\\directory\\directory\\file.txt\n    System.out.print(file.getAbsolutePath()); \/\/ D:\\directory\\directory\\file.txt\n    System.out.print(file.isDirectory());     \/\/ false\n    System.out.print(file.isFile());          \/\/ true\n    System.out.print(file.isAbsolute());      \/\/ true\n    System.out.print(file.lastModified());    \/\/ 1567736964497\n    System.out.print(file.length());          \/\/ 950732640\n    System.out.print(new SimpleDateFormat(\"yyyy-mm-dd\").format(file.lastModified())); \/\/ 2019-09-06\n    System.out.print(String.format(\"%5.2f\", (double) file.length() \/ 1024 \/ 1024)); \/\/ 906.69\n<\/code><\/pre>\n<h4>\u5217\u51fa\u5168\u90e8\u76ee\u5f55<\/h4>\n<p>list\u65b9\u6cd5\u8fd4\u56de\u5b50\u4e00\u7ea7\u8def\u5f84\u76ee\u5f55\u548c\u6587\u4ef6\u540d\u79f0\u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u65e0\u5b8c\u6574\u8def\u5f84<br \/>\nlistFile\u65b9\u6cd5\u8fd4\u56de\u6240\u6709\u5b50\u4e00\u7ea7\u8def\u5f84\u76ee\u5f55\u53ca\u6587\u4ef6\u5bf9\u8c61\uff0c\u542b\u5b8c\u6574\u8def\u5f84<\/p>\n<pre><code class=\"language-java \">    System.out.println(Arrays.toString(file.list()));\n    System.out.println(Arrays.toString(file.listFiles()));\n<\/code><\/pre>\n<pre><code>[dir_0, dir_1, dir_2]\n[D:\\directory\\dir_0, D:\\directory\\dir_1, D:\\directory\\dir_2]\n<\/code><\/pre>\n<p>\u9012\u5f52\u5217\u51fa\u5168\u90e8\u76ee\u5f55\u548c\u6587\u4ef6<\/p>\n<pre><code class=\"language-java \">    public static void listFile(File file) {\n        System.out.println(file);\n        if (file.isDirectory()) {\n            File[] list = file.listFiles();\n            if (list != null) { \/\/ \u9632\u6b62\u7a7a\u6307\u9488\u548c\u7a7a\u6570\u7ec4\n                for (File item : list) {\n                    listFile(item);\n                }\n            }\n        }\n    }\n\n    public static void main(String[] args) throws IOException {\n        File file = new File(\"D:\" + File.separator + \"directory\");\n        listFile(file);\n    }\n<\/code><\/pre>\n<pre><code>D:\\directory\nD:\\directory\\dir_0\nD:\\directory\\dir_0\\test[00].txt\nD:\\directory\\dir_0\\test[01].txt\nD:\\directory\\dir_0\\test[02].txt\nD:\\directory\\dir_1\nD:\\directory\\dir_1\\test[10].txt\nD:\\directory\\dir_1\\test[11].txt\nD:\\directory\\dir_1\\test[12].txt\nD:\\directory\\dir_2\nD:\\directory\\dir_2\\test[20].txt\nD:\\directory\\dir_2\\test[21].txt\nD:\\directory\\dir_2\\test[22].txt\n<\/code><\/pre>\n<h4>\u6587\u4ef6\u5220\u9664\u64cd\u4f5c<\/h4>\n<p>\u76ee\u5f55\u4e2d\u5185\u5bb9\u53ea\u6709\u4e3a\u7a7a\u65f6\u624d\u53ef\u5220\u9664<br \/>\n\u6df1\u5ea6\u4f18\u5148\u5220\u9664\u6587\u4ef6\uff0c\u6700\u7ec8\u5220\u9664\u76ee\u5f55<\/p>\n<pre><code class=\"language-java \">    public static void main(String[] args) throws IOException {\n        File file = new File(\"D:\" + File.separator + \"directory\");\n        delDir(file);\n    }\n\n    public static void delDir(File file) {\n        if(file.isDirectory()){\n            File[] list = file.listFiles();\n            if(list != null){\n                for (File item : list){\n                    delDir(item);\n                }\n            }\n        }\n        file.delete();\n    }\n<\/code><\/pre>\n<h4>\u8def\u5f84\u540d\u79f0\u66f4\u6539<\/h4>\n<p>\u6587\u4ef6\u91cd\u547d\u540d\u5e76\u66f4\u6539\u8def\u5f84<\/p>\n<pre><code class=\"language-java \">    File file0 = new File(\"D:\" + File.separator + \"directory\" + File.separator +\"file0.txt\");\n    File file1 = new File(\"D:\" + File.separator + \"file1.txt\");\n    file0.renameTo(file1);\n<\/code><\/pre>\n<p>\u6587\u4ef6\u6279\u91cf\u91cd\u547d\u540d\uff08\u5f85\u7eed\uff09<\/p>\n<pre><code>\u6307\u5b9aD:\\directory\u76ee\u5f55\u4e0b\n\u6240\u6709\u540d\u5b57\u4e3atest[XX].txt\u7684\u6587\u4ef6\n\u5c06\u6570\u5b57\u957f\u5ea6\u8865\u9f50\u52305\u4f4d\uff0c\u540e\u7f00\u540d\u4fee\u6539\u4e3ajpg\n<\/code><\/pre>\n<pre><code class=\"language-java \">    public static void main(String[] args){\n        File file = new File(\"D:\" + File.separator + \"directory\");\n        renameFile(file);\n    }\n\n    public static void renameFile(File file) {\n        System.out.println(file);\n        if(file.isDirectory()){\n            File[] list = file.listFiles();\n            if(list != null){\n                for (File item : list){\n                    renameFile(item);\n                }\n            }\n        }\n    }\n<\/code><\/pre>\n<h1>\u8f93\u5165\u8f93\u51fa\u6d41\u62bd\u8c61\u7c7b<\/h1>\n<h4>\u5b50\u7c7b\u4e4b\u95f4\u533a\u522b<\/h4>\n<table>\n<thead>\n<tr>\n<th align=\"left\">\u7c7b\u578b<\/th>\n<th align=\"left\">\u5b57\u8282\u6d41<\/th>\n<th align=\"left\">\u5b57\u7b26\u6d41<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">\u9002\u7528\u573a\u666f<\/td>\n<td align=\"left\">\u6587\u4ef6\u3001\u7f51\u7edc<\/td>\n<td align=\"left\">\u6587\u672c\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u4e0e\u786c\u4ef6\u4ea4\u4e92<\/td>\n<td align=\"left\">\u5b57\u8282\u6d41\u76f4\u63a5\u4ea4\u4e92<\/td>\n<td align=\"left\">\u5b57\u7b26\u6d41\u7f13\u51b2\u533a\u4e2d\u8f6c\u5b57\u8282\u6d41<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5199\u786c\u76d8\u65f6\u8bbe\u6709\u7f13\u51b2\u533a\uff0c\u4e3a\u9632\u6b62\u9891\u7e41\u5199\u786c\u76d8\uff0c\u5199\u6ee1\u7f13\u51b2\u533a\u624d\u8fdb\u884c\u771f\u6b63\u7684\u5199\u786c\u76d8\u64cd\u4f5c<br \/>\n\u5728\u6d41\u7684close\u65b9\u6cd5\u4e2d\uff0c\u4f1a\u8c03\u7528flush\u65b9\u6cd5\u5f3a\u5236\u5c06\u7f13\u51b2\u533a\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u5199\u5165\u786c\u76d8<br \/>\nFileOutputStream\u672a\u8c03\u7528close\u65b9\u6cd5\u53ef\u4ee5\u6210\u529f\u5199\u5165\u6587\u4ef6<br \/>\nFileWriter\u9700\u8981\u7f13\u51b2\u533a\uff0c\u672a\u8c03\u7528close\u65b9\u6cd5\u9700\u8981\u4f7f\u7528flush\u65b9\u6cd5\u624d\u53ef\u6210\u529f\u5199\u6587\u4ef6<br \/>\nFileWrite\u672a\u8c03\u7528close\u65b9\u6cd5\u548cflush\u65b9\u6cd5\u800c\u4f7f\u7528\u4e86write\u65b9\u6cd5\uff0c\u5c06\u6e05\u7a7a\u6587\u4ef6\u5185\u5bb9<\/p>\n<h4>\u6d41\u7684\u81ea\u52a8\u5173\u95ed<\/h4>\n<p>\u4e00\u822c\u624b\u52a8\u5728finally\u4e2d\u8fdb\u884c\u5173\u95ed\u64cd\u4f5c\uff0c\u5982\u4e0b\u6240\u793aIO\u6d41\u81ea\u52a8\u5173\u95ed<\/p>\n<pre><code class=\"language-java \">    \u6784\u9020File\u7c7b\u5bf9\u8c61;\n    try( \u5b9e\u4f8b\u5316\u8f93\u5165\u8f93\u51fa\u6d41\u5bf9\u8c61 ){\n        IO\u5904\u7406;\n    }catch(IOException e){\n        \u5f02\u5e38\u5904\u7406;\n    }\n<\/code><\/pre>\n<h2>OutputStream\u62bd\u8c61\u7c7b<\/h2>\n<p>OutputStream\u5b50\u7c7bByteArrayOutputStream, FileOutputStream, FilterOutputStream, ObjectOutputStream, PipedOutputStream<br \/>\n\u907f\u514d\u9891\u7e41\u5199\u5165\u9700\u8981\u4f7f\u7528\u7f13\u51b2\u533a<\/p>\n<pre lang=\"java\">\n    public abstract class OutputStream extends Object\n    implements Closeable, Flushable\n    ------------------------------------------------------------------------------------\n    public void close () throws IOException                      \/\/ \u5173\u95ed\u6d41\u53ca\u76f8\u5173\u7cfb\u7edf\u8d44\u6e90\n    public void flush () throws IOException                          \/\/ \u5f3a\u5236\u8f93\u51fa\u7f13\u51b2\u6570\u636e\n    public abstract void write (int b) throws IOException            \/\/ \u5199\u5165\u5355\u4e2a\u7279\u5b9a\u5b57\u8282\n    public void write (byte[] b) throws IOException               \/\/ \u5199\u5165\u5168\u90e8\u5b57\u8282\u6570\u7ec4\u6570\u636e\n    public void write (byte[] b, int off, int len) throws IOException \/\/ \u5199\u5165\u9009\u5b9a\u90e8\u5206\u5b57\u8282\n<\/pre>\n<h3>FileOutputStream\u5b50\u7c7b<\/h3>\n<pre lang=\"java\">\npublic class FileOutputStream extends OutputStream\n------------------------------------------------------------------------------------------------\npublic FileOutputStream (File file) throws FileNotFoundException                 \/\/ \u4ece\u9996\u5b57\u8282\u5199\u5165\npublic FileOutputStream (File file, boolean append) throws FileNotFoundException \/\/ \u672b\u5c3e\u8ffd\u52a0\u5199\u5165\npublic FileOutputStream (String name) throws FileNotFoundException\npublic FileOutputStream (String name, boolean append) throws FileNotFoundException\n<\/pre>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\nfos0[FileOutputStream] --&gt; |extends| os0[OutputStream]\\nfos0 -.-&gt; |implements| cl0[\\\"&lt;&gt;Closeable\\\"]\\nfos0 -.-&gt; |implements| acl0[\\\"&lt;&gt;AutoCloseable\\\"]\\ncl0 --&gt; |extends| acl0\\nfos0 -.-&gt; |implements| fls0[\\\"&lt;&gt;Flushable\\\"]\\nstyle fos0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle os0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle acl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle fls0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<h4>\u5199\u5165\u6587\u4ef6<\/h4>\n<p>\u7236\u76ee\u5f55\u5b58\u5728\u60c5\u51b5\u4e0b\uff0c<strong>\u65e0\u9700\u8fdb\u884c\u6587\u4ef6\u521b\u5efa<\/strong>\uff0c\u5426\u5219\u5e94\u521b\u5efa<br \/>\nwrite\u5355\u53c2\u65b9\u6cd5\u9ed8\u8ba4\u4ece\u9996\u5b57\u8282\u5f00\u59cb\u5199\u5165\uff0c\u8986\u76d6\u5168\u90e8\u5df2\u6709\u5185\u5bb9<br \/>\n\u540c\u4e00OutputStream\u5b9e\u4f8b\u591a\u6b21\u8c03\u7528write\u5355\u53c2\u65b9\u6cd5\uff0c\u7b2c\u4e00\u6b21\u8986\u76d6\uff0c\u4e4b\u540e\u9ed8\u8ba4\u5c3e\u90e8\u8ffd\u52a0<br \/>\nwrite\u53cc\u53c2\u65b9\u6cd5\u8bbe\u5b9aappend\u4e3atrue\uff0c\u4ece\u6587\u4ef6\u5185\u5bb9\u672b\u5c3e\u8fdb\u884c\u6570\u636e\u8ffd\u52a0<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");\n    OutputStream outputStream = new FileOutputStream(file);\n    \/\/ OutputStream outputStream = new FileOutputStream(file, true);\n    outputStream.write(new String(\"content\\r\\n\").getBytes());\n    outputStream.close();\n<\/code><\/pre>\n<h2>InputStream\u62bd\u8c61\u7c7b<\/h2>\n<p>\u5b50\u7c7bByteArrayInputStream\uff0cFileInputStream\uff0cFilterInputStream\uff0cObjectInputStream\uff0cPipedInputStream\uff0cSequenceInputStream\uff0cStringBufferInputStream<\/p>\n<pre lang=\"java\">\npublic abstract class InputStream\nextends Object\nimplements Closeable\n------------------------------------------------------------------------------\npublic InputStream ()\n------------------------------------------------------------------------------\npublic abstract int read () throws IOException                  \/\/ \u8bfb\u53d6\u4e0b\u4e2a\u5b57\u8282\npublic int read (byte[] b) throws IOException                   \/\/ \u8bfb\u53d6\u5b57\u8282\u6570\u7ec4\npublic int read (byte[] b, int off, int len) throws IOException \/\/ \u8bfb\u53d6\u6307\u5b9a\u6570\u636e\npublic byte[] readAllBytes () throws IOException                \/\/ \u8bfb\u53d6\u6240\u6709\u6570\u636e\npublic int available () throws IOException                      \/\/ \u8fd4\u56de\u5b57\u8282\u6570\u76ee\n<\/pre>\n<h3>FileInputStream\u5b50\u7c7b<\/h3>\n<p>\u6587\u4ef6\u8bfb\u5165\u65e0\u9700\u7f13\u51b2\u533a<\/p>\n<pre lang=\"java\">\npublic class FileInputStream extends InputStream\n-----------------------------------------------------------------\npublic FileInputStream (File file) throws FileNotFoundException\npublic FileInputStream (String name) throws FileNotFoundException\n<\/pre>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\nfis0[FileInputStream] --&gt; |extends| is0[InputStream]\\nfis0 -.-&gt; |implements| cl0[\\\"&lt;&gt;Closeable\\\"]\\nfis0 -.-&gt; |implements| acl0[\\\"&lt;&gt;AutoCloseable\\\"]\\ncl0 --&gt; |extends| acl0\\nstyle fis0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle is0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle acl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<h4>\u8bfb\u5165\u6587\u4ef6<\/h4>\n<p>\u8f93\u5165\u6d41\u9700\u5224\u65ad\u6587\u4ef6\u5b58\u5728\uff0c\u4e0d\u5b58\u5728\u62a5FileNotFoundException<br \/>\nread\u65b9\u6cd5\u8fd4\u56de\u8bfb\u53d6\u5230\u7684\u5b57\u8282\u6570\uff0c\u82e5\u8bfb\u53d6\u5b8c\u6bd5\u8fd4\u56de-1<br \/>\nread\u65e0\u53c2\u65b9\u6cd5\u6309\u987a\u5e8f\u6bcf\u6b21\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282<br \/>\nread\u5355\u53c2\u65b9\u6cd5\u5c06\u6587\u4ef6\u8bfb\u5165\u5b57\u8282\u6570\u7ec4\u4e2d\uff0c\u6bcf\u6b21\u8bfb\u53d6\u5c3a\u5bf8\u4e3a\u5b57\u8282\u6570\u7ec4\u5927\u5c0f<br \/>\nread\u5355\u53c2\u65b9\u6cd5\u8bfb\u53d6\u5185\u5bb9\u6570\u91cf\u4e0d\u8db3\u8865\u4f59\u4e3a0\uff0c\u9020\u6210\u7a7a\u95f4\u6d6a\u8d39\uff0c\u7528len\u89e3\u51b3<br \/>\n\u6bcf\u8c03\u7528\u4e00\u6b21read\u65b9\u6cd5\uff0c\u9ed8\u8ba4\u4ece\u4e0a\u6b21\u7ed3\u675f\u5904\u5f00\u59cb\u8bfb\u53d6<\/p>\n<ul>\n<li>\u9010\u5b57\u8282\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9<\/li>\n<\/ul>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");\n    try (InputStream in = new FileInputStream(file)) {\n    int item = -1;\n        if (file.exists()) {\n            while ((item = in.read()) != -1) {\n                System.out.print((char) item);\n            }\n        }\n    } catch (IOException e){\n        e.printStackTrace();\n    }\n<\/code><\/pre>\n<ul>\n<li>\u9010\u5b57\u8282\u6570\u7ec4\u8bfb\u53d6source\u6587\u4ef6\u7684\u5185\u5bb9\u5199\u5165\u65b0\u7684\u6587\u4ef6target\u6587\u4ef6\u4e2d<\/li>\n<\/ul>\n<pre><code class=\"language-java \">    File sourceFile = new File(\"D:\" + File.separator + \"source_file.txt\");\n    File targetFile = new File(\"D:\" + File.separator + \"target_file.txt\");\n    InputStream inputStream = null;\n    OutputStream outputStream = null;\n    if (sourceFile.exists()) {\n        try {\n            int len = -1;\n            byte[] content = new byte[1024];\n            inputStream = new FileInputStream(sourceFile);\n            outputStream = new FileOutputStream(targetFile);\n            while ((len = inputStream.read(content)) != -1) {\n                outputStream.write(content, 0, len);\n            }\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        finally {\n            inputStream.close();\n            outputStream.close();\n        }\n    }\n<\/code><\/pre>\n<ul>\n<li>readAllBytes\u65b9\u6cd5\u4e00\u6b21\u6027\u5c06\u6587\u4ef6\u5168\u90e8\u8bfb\u5165\u5b57\u8282\u6570\u7ec4\uff0c\u6587\u4ef6\u5927\u5c0f\u8d85\u8fc72GB\u4f1a\u62a5OutOfMemoryError<\/li>\n<\/ul>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");\n    InputStream inputStream = null;\n    if (sourceFile.exists()) {\n        try {\n            inputStream = new FileInputStream(sourceFile);\n            if(inputStream.available() &lt; 2 * 1024 * 1024 * 1024){\n                byte[] content = inputStream.readAllBytes();\n                System.out.println(new String(content));\n            }\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        finally {\n            inputStream.close();\n            outputStream.close();\n        }\n    }\n<\/code><\/pre>\n<h2>Writer\u62bd\u8c61\u7c7b<\/h2>\n<p>\u5b50\u7c7bBufferedWriter, CharArrayWriter, FilterWriter, OutputStreamWriter, PipedWriter, PrintWriter, StringWriter<\/p>\n<pre lang=\"java\">\npublic abstract class Writer\nextends Object\nimplements Appendable, Closeable, Flushable\n-----------------------------------------------------------------\nprotected Writer ()                               \/\/ Writer\u672c\u8eab\u540c\u6b65\nprotected Writer (Object lock)                      \/\/ \u4f20\u5165\u5bf9\u8c61\u540c\u6b65\npublic Writer append (char c) throws IOException    \/\/ \u8ffd\u52a0\u5355\u4e2a\u5b57\u7b26\npublic Writer append (CharSequence csq) throws IOException\npublic Writer append (CharSequence csq, int start, int end) throws IOException\npublic abstract void close () throws IOException\npublic abstract void flush () throws IOException\npublic void write (char[] cbuf) throws IOException\npublic void write (String str) throws IOException\npublic void write (String str, int off, int len) throws IOException\npublic abstract void write (char[] cbuf, int off, int len) throws IOException\n<\/pre>\n<h3>FileWriter\u5b50\u7c7b<\/h3>\n<p>\u53ef\u76f4\u63a5\u8f93\u51fa\u5355\u4e2a\u5b57\u7b26\u3001\u5b57\u7b26\u6570\u7ec4\u3001\u5b57\u7b26\u4e32<br \/>\n\u63a5\u6536CharSequence\u5b9e\u4f8b\u53ef\u4f7f\u7528StringBuffer\u3001StringBuilder\u7b49<\/p>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\ncls0[\\\"&lt;&gt;Closeable\\\"] --&gt; |extends| acl0[\\\"&lt;&gt;AutoCloseable\\\"]\\nwri0[\\\"FileWriter\\\"] --&gt; |implements| cls0\\nwri0 -.-&gt; |implements| fls0[\\\"&lt;&gt;Flushable\\\"]\\nwri0 -.-&gt; |implements| apd0[\\\"&lt;&gt;Appendable\\\"]\\nwri0 -.-&gt; |implements| acl0\\nwri0 --&gt; |extends| wri1[\\\"OutputStreamWriter\\\"]\\nwri1 --&gt; |extends| wri2[\\\"{abstract}Writer\\\"]\\napd0 -.-&gt; |use| cha0[\\\"&lt;&gt;CharSequence\\\"]\\nwri0 -.-&gt; |use| cha0[\\\"&lt;&gt;CharSequence\\\"]\\nstyle acl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cls0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle wri0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle wri1 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle wri2 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle fls0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle apd0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cha0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<h4>\u5199\u5165\u6587\u4ef6<\/h4>\n<p>\u65e0\u9700\u521b\u5efa\u6587\u4ef6\uff0c\u53ea\u9700\u4fdd\u8bc1\u7236\u76ee\u5f55\u5b58\u5728<br \/>\n\u540c\u4e00FileWriter\u5b9e\u4f8b\u591a\u6b21\u8c03\u7528write\u65b9\u6cd5\uff0c\u7b2c\u4e00\u6b21\u8986\u76d6\uff0c\u4e4b\u540e\u9ed8\u8ba4\u5c3e\u90e8\u8ffd\u52a0<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"directory\" + File.separator + \"file.txt\");\n    FileWriter writer = null;\n    if(!file.getParentFile().exists()){\n        file.getParentFile().mkdirs();\n    }\n    try {\n        writer = new FileWriter(file);\n        writer.write(\"Test0\");\n        writer.write(new char[]{'T', 'e', 's', 't', '1'});\n        writer.write(\"Test2\", 0, 4); \/\/ 0\u5f00\u59cb\uff0c\u51994\u4e2a\u5b57\u7b26\n        writer.write(new char[]{'T', 'e', 's', 't', '3'}, 0, 4);\n        writer.append('e'); \/\/ \u8ffd\u52a0\u5355\u4e2a\u5b57\u7b26\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    finally{\n        writer.close();\n    }\n<\/code><\/pre>\n<h2>Reader\u62bd\u8c61\u7c7b<\/h2>\n<p>\u5b50\u7c7bBufferedReader, CharArrayReader, FilterReader, InputStreamReader, PipedReader, StringReader, URLReader<\/p>\n<pre lang=\"java\">\npublic abstract class Reader\nextends Object\nimplements Readable, Closeable\n------------------------------------------------\nprotected Reader ()\nprotected Reader (Object lock)\n------------------------------------------------\npublic abstract void close () throws IOException\npublic int read () throws IOException                                       \/\/ \u8bfb\u5165\u4e00\u4e2a\u5b57\u7b26\uff0c\u963b\u585e\u65b9\u6cd5\npublic int read (char[] cbuf) throws IOException                            \/\/ \u8bfb\u5165\u5b57\u7b26\u6570\u7ec4\uff0c\u963b\u585e\u65b9\u6cd5\npublic abstract int read (char[] cbuf, int off, int len) throws IOException \/\/ \u8bfb\u5165\u9009\u5b9a\u5b57\u7b26\u5230\u6570\u7ec4\uff0c\u963b\u585e\u65b9\u6cd5\npublic long skip (long n) throws IOException                                \/\/ \u8df3\u8fc7n\u4e2a\u5b57\u7b26\uff0c\u963b\u585e\u65b9\u6cd5\n<\/pre>\n<h3>FileReader\u5b50\u7c7b<\/h3>\n<pre lang=\"java\">\npublic class FileReader extends InputStreamReader\n----------------------------------------------------------------\npublic FileReader (String fileName) throws FileNotFoundException\npublic FileReader (File file) throws FileNotFoundException\n<\/pre>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\nfrd0[\\\"FileReader\\\"]\\nrdr0[\\\"{abstract}Reader\\\"]\\nird0[\\\"&lt;&gt;InputStreamReader\\\"]\\ncls0[\\\"&lt;&gt;Closeable\\\"]\\nacl0[\\\"&lt;&gt;AutoCloseable\\\"]\\nrdb0[\\\"&lt;&gt;Readable\\\"]\\ncbf0[\\\"CharBuffer\\\"]\\ncls0 --&gt; |extends| acl0\\nfrd0 --&gt; |extends| ird0\\nird0 --&gt; |extends| rdr0\\nfrd0 -.-&gt; |implements| rdb0\\nfrd0 -.-&gt; |implements| cls0\\nfrd0 -.-&gt; |implements| acl0\\nrdb0 -.-&gt; |use| cbf0\\nstyle frd0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle rdr0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle ird0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cls0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle acl0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle rdb0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle cbf0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<h4>\u8bfb\u53d6\u5b57\u7b26<\/h4>\n<p>\u9010\u5b57\u7b26\u8bfb\u5165\u6240\u6709\u6587\u4ef6\u5185\u5bb9\u5e76\u8f93\u51fa<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");\n    Reader reader = null;\n    int item;\n    if (file.exists()) {\n        try {\n            reader = new FileReader(file);\n            while ((item = reader.read()) != -1)\n                System.out.print((char) item);\n        } catch (IOException e) {\n            e.printStackTrace();\n        } finally {\n            reader.close();\n        }\n    }\n<\/code><\/pre>\n<p>\u5b57\u7b26\u8bfb\u5165\u5b57\u7b26\u6570\u7ec4\u9010\u6570\u7ec4\u8bfb\u53d6<\/p>\n<pre><code class=\"language-java \">    File file = new File(\"D:\" + File.separator + \"file.txt\");\n    int len = 0;\n    Reader reader = null;\n    char[] content = new char[1024];\n    if (file.exists()) {\n        try {\n            reader = new FileReader(file);\n            while ((len = reader.read(content)) != -1)\n                System.out.print(new String(content, 0, len));\n        } catch (IOException e) {\n            e.printStackTrace();\n        } finally {\n            reader.close();\n        }\n    }\n<\/code><\/pre>\n<h2>\u5b57\u7b26\u6d41\u548c\u5b57\u8282\u6d41\u8f6c\u6362<\/h2>\n<p>\u5b57\u8282\u6d41\u8f6c\u6362\u4e3a\u5b57\u7b26\u6d41\u65b9\u4fbf\u8fdb\u884c\u6587\u672c\u76f8\u5173\u64cd\u4f5c<br \/>\nFileOutputStream\/FileInputStream\u5747\u4e3a\u5b57\u8282\u6d41<br \/>\nFileWriter\/FileReader\u7c7b\u5747\u7ecf\u7531\u8f6c\u6362\u6d41\uff0c\u5c06\u5b57\u8282\u6d41\u8f6c\u6362\u4e3a\u5b57\u7b26\u6d41<\/p>\n<h3>OutputStreamWriter\u7c7b<\/h3>\n<pre lang=\"java\">\npublic class OutputStreamWriter extends Writer\n-----------------------------------------------------------------------------------------\npublic OutputStreamWriter (OutputStream out)\npublic OutputStreamWriter (OutputStream out, Charset cs)\npublic OutputStreamWriter (OutputStream out, CharsetEncoder enc)\n-----------------------------------------------------------------------------------------\npublic Writer append (CharSequence csq) throws IOException\npublic Writer append (CharSequence csq, int start, int end) throws IOException\npublic void close () throws IOException\npublic void flush () throws IOException\npublic void write (char[] cbuf, int off, int len) throws IOException\npublic void write (int c) throws IOException\npublic void write (String str, int off, int len) throws IOException\n<\/pre>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\nwri0[\\\"{abstract}Writer\\\"]\\nwri1[\\\"OutputStreamWriter\\\"]\\nops0[\\\"{abstract}OutputStream\\\"]\\nwri1 --&gt; | extends | wri0\\nwri1 -.-&gt; | use | ops0\\nstyle wri0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle wri1 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle ops0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<p>OutputStreamWriter\u662f\u5b57\u7b26\u6d41Writer\u5b50\u7c7b\uff0c\u63a5\u6536OutputStream\u5bf9\u8c61\uff0c\u5411\u4e0a\u8f6c\u578b\u4e3a\u5b57\u7b26\u6d41<\/p>\n<h3>InputStreamReader\u7c7b<\/h3>\n<pre lang=\"java\">\npublic class InputStreamReader extends Reader\n----------------------------------------------------------------------------------------------------------------------\npublic InputStreamReader (InputStream in)\npublic InputStreamReader (InputStream in, String charsetName) throws UnsupportedEncodingException\npublic InputStreamReader (InputStream in, Charset cs)\npublic InputStreamReader (InputStream in, CharsetDecoder dec)\n----------------------------------------------------------------------------------------------------------------------\npublic void close () throws IOException\npublic int read () throws IOException\npublic int read (char[] cbuf, int offset, int length) throws IOException\n<\/pre>\n<h4>\u7ee7\u627f\u7ed3\u6784<\/h4>\n<div class=\"mermaid mermaid-diagram no-emojify\"><script type=\"text\/javascript\">document.write(\"graph BT\\nred0[\\\"{abstract}Reader\\\"]\\nred1[\\\"InputStreamReader\\\"]\\nips0[\\\"{abstract}InputStream\\\"]\\nred1 --&gt; | extends | red0\\nred1 -.-&gt; | use | ips0\\nstyle red0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle red1 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\nstyle ips0 fill:#FFFFFF,stroke:#CCCCCC,stroke-width:2px\\n\");<\/script><\/div>\n<p>InputStreamReader\u662f\u5b57\u7b26\u6d41Reader\u5b50\u7c7b\uff0c\u63a5\u6536InputStream\u5bf9\u8c61\uff0c\u5411\u4e0a\u8f6c\u578b\u4e3a\u5b57\u7b26\u6d41<\/p>\n<h3>\u8f6c\u6362\u5b9e\u4f8b<\/h3>\n<p>\u5199\u64cd\u4f5c\u8981\u8fdb\u884c<strong>close\u65b9\u6cd5\u6216flush\u65b9\u6cd5<\/strong>\u786e\u4fdd\u5185\u5bb9\u5199\u5165\u6587\u4ef6<\/p>\n<pre><code class=\"language-java \">    OutputStream out = null;\n    Writer writer = null;\n    try{\n        File file = new File(\"D:\" + File.separator + \"file.txt\");\n        out = new FileOutputStream(file);\n        writer = new OutputStreamWriter(out);\n        writer.write(\"test_text\");\n    }catch (IOException e){\n        e.printStackTrace();\n    }finally {\n        if (writer != null) { writer.close(); }\n        if (out != null) { out.close(); }\n    }\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>IO\u6838\u5fc3 IO\u64cd\u4f5c\u4e3b\u8981\u7c7b\u548c\u65b9\u6cd5\u4f4d\u4e8ejava.io.* &gt; File\u7c7b \u6587\u4ef6\u64cd\u4f5c &gt; Seriali &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/139.196.114.170\/?p=653\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c[java\u7279\u6027]\u6587\u4ef6\u64cd\u4f5cFile\u4e0e\u6587\u4ef6\u8bfb\u5199IO\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[25],"tags":[21,20,22],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/653"}],"collection":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=653"}],"version-history":[{"count":53,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/653\/revisions"}],"predecessor-version":[{"id":1009,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/653\/revisions\/1009"}],"wp:attachment":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}