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