提示

Java IO OutputStreamWriter 使用示例。@ermo

回到上一级

    public static void write() throws IOException {
        String data = "Some text wait to output to file.";
        String filepath = "src/main/resources/output.txt";
        OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(filepath));
        try {
            out.write(data);
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) throws IOException {
        write();
    }
上次更新: 1/3/2023, 9:20:13 PM