类 InputStreams
- java.lang.Object
-
- net.dongliu.commons.io.InputStreams
-
public class InputStreams extends java.lang.ObjectUtils for InputStreams.
-
-
构造器概要
构造器 构造器 说明 InputStreams()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static java.io.InputStreamconcat(byte[] data, java.io.InputStream in)Return a new InputStream that concat additional prepended data and InputStream.static java.io.InputStreamconcat(java.io.InputStream... inputs)Return a new InputStream that concat multi sub InputStreams.static java.io.InputStreamconcat(java.util.List<java.io.InputStream> inputs)Return a new InputStream that concat multi sub InputStreams.static longdiscardAll(java.io.InputStream in)Skip or read all data till EOF from InputStream.static java.io.InputStreamempty()Return a empty input stream with no data.static byte[]readAll(java.io.InputStream in)Read all data in InputStream.static intreadExact(java.io.InputStream in, byte[] data, int offset, int len)Read exact data with size, into data.static byte[]readExact(java.io.InputStream in, int len)Read exact data with size.static voidtransferTo(java.io.InputStream in, java.io.OutputStream out)Copy all data in InputStream to OutputStream.
-
-
-
方法详细资料
-
transferTo
public static void transferTo(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOExceptionCopy all data in InputStream to OutputStream. Both in and out are left unclosed when copy finished, or Exception occurred.- 抛出:
java.io.IOException
-
readAll
public static byte[] readAll(java.io.InputStream in) throws java.io.IOExceptionRead all data in InputStream. The Stream is left unclosed when read finished, or Exception occurred.- 抛出:
java.io.IOException
-
readExact
public static int readExact(java.io.InputStream in, byte[] data, int offset, int len) throws java.io.IOExceptionRead exact data with size, into data. The InputStream is not close after read or Exception occurred.- 返回:
- The real data size read. If InputStream does not has enough data for read, will return a size less than desired.
- 抛出:
java.io.IOException
-
readExact
public static byte[] readExact(java.io.InputStream in, int len) throws java.io.IOExceptionRead exact data with size. The InputStream is not close after read or Exception occurred.- 返回:
- The data read. If InputStream does not has enough data for read, will return a byte array which len less than desired size.
- 抛出:
java.io.IOException
-
discardAll
public static long discardAll(java.io.InputStream in) throws java.io.IOExceptionSkip or read all data till EOF from InputStream. The InputStream is left unclosed.- 返回:
- the total data size read
- 抛出:
java.io.IOException
-
empty
public static java.io.InputStream empty()
Return a empty input stream with no data.
-
concat
public static java.io.InputStream concat(java.util.List<java.io.InputStream> inputs)
Return a new InputStream that concat multi sub InputStreams. The close() method of returned InputStream will close all sub InputStreams.
-
concat
public static java.io.InputStream concat(java.io.InputStream... inputs)
Return a new InputStream that concat multi sub InputStreams. The close() method of returned InputStream will close all sub InputStreams.
-
concat
public static java.io.InputStream concat(byte[] data, java.io.InputStream in)Return a new InputStream that concat additional prepended data and InputStream. The close() method of returned InputStream will close the passed in InputStream.
-
-