Record Class XSProlog

java.lang.Object
java.lang.Record
com.io7m.xstructural.vanilla.internal.format.XSProlog
Record Components:
version - The version value, never null
encoding - The encoding value, or null if absent
standalone - The standalone value: -1 if absent, 0 for "no", 1 for "yes"
hasBom - Whether the input began with a UTF-8 byte-order mark

public record XSProlog(String version, String encoding, int standalone, boolean hasBom) extends Record
The XML declaration and byte-order mark of a document, captured from the input so that it can be repeated verbatim in the formatted output.
  • Constructor Details

    • XSProlog

      public XSProlog(String version, String encoding, int standalone, boolean hasBom)
      Constructor.
  • Method Details

    • read

      public static XSProlog read(Path input) throws IOException
      Read the prolog from the leading bytes of a file.
      Parameters:
      input - The input file
      Returns:
      The prolog
      Throws:
      IOException - On errors
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • encoding

      public String encoding()
      Returns the value of the encoding record component.
      Returns:
      the value of the encoding record component
    • standalone

      public int standalone()
      Returns the value of the standalone record component.
      Returns:
      the value of the standalone record component
    • hasBom

      public boolean hasBom()
      Returns the value of the hasBom record component.
      Returns:
      the value of the hasBom record component