⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 streams.java

📁 kmlnjlkj nlkjlkjkljl okopokipoipo oipipipo i
💻 JAVA
字号:
package org.bouncycastle.util.io;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;public final class Streams{    private static int BUFFER_SIZE = 512;    public static byte[] readAll(InputStream inStr)        throws IOException    {        ByteArrayOutputStream buf = new ByteArrayOutputStream();        pipeAll(inStr, buf);        return buf.toByteArray();    }    public static int readFully(InputStream inStr, byte[] buf)        throws IOException    {        return readFully(inStr, buf, 0, buf.length);    }    public static int readFully(InputStream inStr, byte[] buf, int off, int len)        throws IOException    {        int totalRead = 0;        while (totalRead < len)        {            int numRead = inStr.read(buf, off + totalRead, len - totalRead);            if (numRead < 0)            {                break;            }            totalRead += numRead;        }        return totalRead;    }    public static void pipeAll(InputStream inStr, OutputStream outStr)        throws IOException    {        byte[] bs = new byte[BUFFER_SIZE];        int numRead;        while ((numRead = inStr.read(bs, 0, bs.length)) >= 0)        {            outStr.write(bs, 0, numRead);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -