private boolean tryReadHeader() throws IOException {
    if (endOfCiphertext) {
      throw new IOException("Ciphertext is too short");
    }
    readSomeCiphertext(header);
    if (header.remaining() > 0) {
      return false;
    } else {
      header.flip();
      try {
        decrypter.init(header, associatedData);
        headerRead = true;
      } catch (GeneralSecurityException ex) {
        // TODO(b/74249330): Try to define the state of this.
        setUndefinedState();
        throw new IOException(ex);
      }
      return true;
    }
  }
Tries to read the header of the ciphertext.
@return true if the header has been fully read and false if not enough bytes were available
         from the ciphertext stream.
@throws IOException when an exception occurs while reading the ciphertextStream or when
        the header is too short.
java_src/src/main/java/com/google/crypto/tink/subtle/StreamingAeadDecryptingChannel.java