public class StreamWriter extends Object
OutputStream写出器| 构造器和说明 |
|---|
StreamWriter(OutputStream out,
boolean closeAfterWrite)
构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
static StreamWriter |
of(OutputStream out,
boolean closeAfterWrite)
创建写出器
|
void |
write(byte[] content)
将byte[]写到流中
|
void |
writeObj(Object... contents)
将多部分对象写到流中,使用
ObjectOutputStream,对象必须实现序列化接口 |
void |
writeStr(Charset charset,
Object... contents)
将多部分内容写到流中,自动转换为字符串
|
public StreamWriter(OutputStream out, boolean closeAfterWrite)
out - OutputStreamcloseAfterWrite - 写出结束后是否关闭流public static StreamWriter of(OutputStream out, boolean closeAfterWrite)
out - OutputStreamcloseAfterWrite - 写出结束后是否关闭流public void write(byte[] content)
throws IORuntimeException
content - 写入的内容IORuntimeException - IO异常public void writeObj(Object... contents) throws IORuntimeException
ObjectOutputStream,对象必须实现序列化接口contents - 写入的内容IORuntimeException - IO异常public void writeStr(Charset charset, Object... contents) throws IORuntimeException
charset - 写出的内容的字符集contents - 写入的内容,调用toString()方法,不包括不会自动换行IORuntimeException - IO异常Copyright © 2024. All rights reserved.