code: public static byte[] readAll(InputStream source, int length) throws IOException {
          byte[] ret = new byte[length];
          int readBytes = readAll(source, ret, 0, ret.length);
          if (readBytes < ret.length) {
              throw new EOFException(String.format(
                      "Was only able to read %d bytes, which is less than the requested length of %d.", readBytes, ret.length));
          }
  
          return ret;
      }
docs: Reads a number of bytes from the given InputStream and returns it as the given byte array.
  
  @param source The InputStream to read.
  @param length The number of bytes to read.
  @return A byte array containing the contents of the Stream.
  @throws IOException If unable to read from the given InputStream. Throws {@link EOFException} if the number of bytes
  remaining in the InputStream is less than length.