package com.shrimpking.t4;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/9/22 21:07
*/
//ch16-7
public class StreamDemo
{
public static void main(String[] args)
{
File f = new File("d:\\test\\temp.txt");
OutputStream out = null;
try
{
out = new FileOutputStream(f);
}catch (FileNotFoundException e){
e.printStackTrace();
}
//将字符串转换成字节数组
String str = "Hello World";
byte[] bytes = str.getBytes();
11-02
1303
12-15