⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bytearrayoutputstream.java

📁 由于想一次上传成功 所以将二个教程打包成了一个 这些例子几乎包含了所有java的框架集合
💻 JAVA
字号:
import java.io.*;

class bytearrayoutputstream 
{
    public static void main(String args[]) throws IOException 
    {
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        byte data[] = "Here is a string".getBytes();

        bytearrayoutputstream.write(data);

        System.out.println(bytearrayoutputstream.toString());

        byte buffer[] = bytearrayoutputstream.toByteArray();
        for (int loop_index = 0; loop_index < data.length; loop_index++) {
            System.out.print((char) buffer[loop_index]);
        }

        OutputStream fileoutputstream = new FileOutputStream("file.txt");
        bytearrayoutputstream.writeTo(fileoutputstream);
        fileoutputstream.close();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -