code: public static byte[] read(InputStream in, int bufSize) throws IOException {
          log.debug("开始从流中读取数据，缓冲区大小为{}byte", bufSize);
          ByteArray array = new ByteArray();
          int len;
          byte[] buffer = new byte[bufSize];
          while ((len = in.read(buffer, 0, buffer.length)) != -1) {
              array.append(buffer, 0, len);
          }
          log.debug("读取完毕");
          return array.getData();
      }
docs: 将流读取为byte数组
  
  @param in      输入流
  @param bufSize 自定义缓冲区大小
  @return 字节数组
  @throws IOException IO异常