public abstract class Streams extends Object
构造器和说明 |
---|
Streams() |
限定符和类型 | 方法和说明 |
---|---|
protected static InputStream |
_input(File file)
获取File对象输入流,即使在Jar文件中一样工作良好!!
|
static void |
appendWriteAndClose(File f,
String text) |
static BufferedInputStream |
buff(InputStream ins)
为一个输入流包裹一个缓冲流。
|
static BufferedOutputStream |
buff(OutputStream ops)
为一个输出流包裹一个缓冲流。
|
static BufferedReader |
buffr(Reader reader)
为一个文本输入流包裹一个缓冲流。
|
static BufferedWriter |
buffw(Writer ops)
为一个文本输出流包裹一个缓冲流。
|
static int |
eachLine(Reader r,
Each<String> callback)
对一个文本输入流迭代每一行,并将其关闭
|
static boolean |
equals(InputStream sA,
InputStream sB)
判断两个输入流是否严格相等
|
static InputStream |
fileIn(File file)
根据一个文件路径建立一个输入流
|
static InputStream |
fileIn(String path)
根据一个文件路径建立一个输入流
|
static Reader |
fileInr(File file)
根据一个文件路径建立一个 UTF-8 文本输入流 警告!!
|
static Reader |
fileInr(String path)
根据一个文件路径建立一个 UTF-8文本输入流 警告!!
|
static OutputStream |
fileOut(File file)
根据一个文件建立一个输出流
|
static OutputStream |
fileOut(String path)
根据一个文件路径建立一个输出流
|
static Writer |
fileOutw(File file)
根据一个文件建立一个 UTF-8 文本输出流
|
static Writer |
fileOutw(String path)
根据一个文件路径建立一个 UTF-8 文本输出流
|
static String |
nextLineTrim(BufferedReader br) |
static InputStream |
nullInputStream() |
static StringBuilder |
read(Reader reader)
从一个文本流中读取全部内容并返回
注意,它并不会关闭输出流
|
static int |
read(Reader reader,
StringBuilder sb)
从一个文本流中读取全部内容并写入缓冲
注意,它并不会关闭输出流
|
static int |
readAndClose(InputStreamReader reader,
StringBuilder sb)
从一个文本流中读取全部内容并写入缓冲
注意,它会关闭输出流
|
static String |
readAndClose(Reader reader)
从一个文本流中读取全部内容并返回
注意,它会关闭输入流
|
static byte[] |
readBytes(InputStream ins)
读取一个输入流中所有的字节
|
static byte[] |
readBytesAndClose(InputStream ins)
读取一个输入流中所有的字节,并关闭输入流
|
static boolean |
safeClose(Closeable cb)
关闭一个可关闭对象,可以接受 null。
|
static void |
safeFlush(Flushable fa)
安全刷新一个可刷新的对象,可接受 null
|
static InputStream |
utf8filte(InputStream in)
判断并移除UTF-8的BOM头
|
static Reader |
utf8r(InputStream is) |
static Writer |
utf8w(OutputStream os) |
static InputStream |
wrap(byte[] bytes) |
static void |
write(OutputStream ops,
byte[] bytes)
将一个字节数组写入一个输出流。
|
static long |
write(OutputStream ops,
InputStream ins)
将输入流写入一个输出流。
|
static long |
write(OutputStream ops,
InputStream ins,
int bufferSize)
将输入流写入一个输出流。
|
static void |
write(Writer writer,
CharSequence cs)
将一段文本全部写入一个writer。
|
static long |
write(Writer writer,
Reader reader)
将文本输入流写入一个文本输出流。
|
static void |
writeAndClose(OutputStream ops,
byte[] bytes)
将一个字节数组写入一个输出流。
|
static long |
writeAndClose(OutputStream ops,
InputStream ins)
将输入流写入一个输出流。
|
static long |
writeAndClose(OutputStream ops,
InputStream ins,
int buf) |
static void |
writeAndClose(Writer writer,
CharSequence cs)
将一段文本全部写入一个writer。
|
static long |
writeAndClose(Writer writer,
Reader reader)
将文本输入流写入一个文本输出流。
|
public static boolean equals(InputStream sA, InputStream sB) throws IOException
IOException
public static void write(Writer writer, CharSequence cs) throws IOException
注意,它并不会关闭输出流
writer
- cs
- 文本IOException
public static void writeAndClose(Writer writer, CharSequence cs)
注意,它会关闭输出流
writer
- 输出流cs
- 文本public static long write(OutputStream ops, InputStream ins) throws IOException
注意,它并不会关闭输入/出流
ops
- 输出流ins
- 输入流IOException
public static long write(OutputStream ops, InputStream ins, int bufferSize) throws IOException
注意,它并不会关闭输入/出流
ops
- 输出流ins
- 输入流bufferSize
- 缓冲块大小IOException
public static long writeAndClose(OutputStream ops, InputStream ins)
注意,它会关闭输入/出流
ops
- 输出流ins
- 输入流public static long write(Writer writer, Reader reader) throws IOException
注意,它并不会关闭输入/出流
writer
- 输出流reader
- 输入流IOException
public static long writeAndClose(Writer writer, Reader reader)
注意,它会关闭输入/出流
writer
- 输出流reader
- 输入流public static void write(OutputStream ops, byte[] bytes) throws IOException
注意,它并不会关闭输出流
ops
- 输出流bytes
- 字节数组IOException
public static void writeAndClose(OutputStream ops, byte[] bytes)
注意,它会关闭输出流
ops
- 输出流bytes
- 字节数组public static StringBuilder read(Reader reader) throws IOException
注意,它并不会关闭输出流
reader
- 文本输出流IOException
public static String readAndClose(Reader reader)
注意,它会关闭输入流
reader
- 文本输入流IOException
public static int read(Reader reader, StringBuilder sb) throws IOException
注意,它并不会关闭输出流
reader
- 文本输出流sb
- 输出的文本缓冲IOException
public static int readAndClose(InputStreamReader reader, StringBuilder sb)
注意,它会关闭输出流
reader
- 文本输出流sb
- 输出的文本缓冲public static byte[] readBytes(InputStream ins) throws IOException
ins
- 输入流,必须支持 available()IOException
public static byte[] readBytesAndClose(InputStream ins)
ins
- 输入流,必须支持 available()IOException
public static boolean safeClose(Closeable cb)
cb
- 可关闭对象public static void safeFlush(Flushable fa)
fa
- 可刷新对象public static BufferedInputStream buff(InputStream ins)
ins
- 输入流。public static BufferedOutputStream buff(OutputStream ops)
ops
- 输出流。public static BufferedReader buffr(Reader reader)
reader
- 文本输入流。public static BufferedWriter buffw(Writer ops)
ops
- 文本输出流。public static InputStream fileIn(String path)
path
- 文件路径public static InputStream fileIn(File file)
file
- 文件public static Reader fileInr(String path)
path
- 文件路径public static Reader fileInr(File file)
file
- 文件public static InputStream utf8filte(InputStream in)
public static OutputStream fileOut(String path)
path
- 文件路径public static OutputStream fileOut(File file)
file
- 文件public static Writer fileOutw(String path)
path
- 文件路径public static Reader utf8r(InputStream is)
public static Writer utf8w(OutputStream os)
public static InputStream nullInputStream()
public static InputStream wrap(byte[] bytes)
public static int eachLine(Reader r, Each<String> callback)
r
- 文本输入流callback
- 回调protected static InputStream _input(File file) throws IOException
IOException
public static String nextLineTrim(BufferedReader br) throws IOException
IOException
public static long writeAndClose(OutputStream ops, InputStream ins, int buf)
Copyright © 2017. All rights reserved.