code: public byte[] readRemainingBytes() throws IOException {
      if (this.available() > 0) {
        byte[] b = new byte[this.available()];
        if (read(b) >= 0) {
          return b;
        } else {
          throw new IOException("returned negative number of remaining bytes");
        }
      } else {
        throw new IOException("no more bytes");
      }
    }
docs: Read remaining bytes.
  
  @return the byte[]
  @throws IOException Signals that an I/O exception has occurred.