code: public byte[] readBytes(InputStream src) throws IOException {
          int count;
          byte[] result;
          ByteArrayOutputStream dest;
  
          // fill buffer first, try to handle without ByteArrayOutputStream
          count = fill(src);
          if (count < size()) {
              result = new byte[count];
              System.arraycopy(buffer, 0, result, 0, count);
              return result;
          }
          dest = new ByteArrayOutputStream(buffer.length * 2);
          dest.write(buffer, 0, count);
          copy(src, dest);
          return dest.toByteArray();
      }
docs: --