Class DoctypeInterpolator


  • public class DoctypeInterpolator
    extends java.lang.Object
    Attempts to check that a DOCTYPE declaration is present in an input stream representing XML. If it is not, one is inserted. The algorithm used here isn't bulletproof, but should work in most sensible cases, and fail noisily if it can't do it. It copes with a number of not-too-weird XML encodings.
    Author:
    Mark Taylor (Starlink)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getStreamWithDoctype​(java.io.BufferedInputStream in)
      Returns an input stream which is a copy of a given one, except that if the given one doesn't include a DOCTYPE declaration, one is inserted.
      java.lang.String getVotableVersion()
      Returns the value of the version attribute of the top-level VOTABLE element, if there was one and it was encountered.
      static void main​(java.lang.String[] args)
      Filter program which takes a stream on standard output and writes to standard output including the DOCTYPE.
      void message​(java.lang.String msg)
      Presents a processing message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DoctypeInterpolator

        public DoctypeInterpolator()
    • Method Detail

      • getStreamWithDoctype

        public java.io.InputStream getStreamWithDoctype​(java.io.BufferedInputStream in)
                                                 throws java.io.IOException
        Returns an input stream which is a copy of a given one, except that if the given one doesn't include a DOCTYPE declaration, one is inserted. This method can only be called once for each instance of this class.
        Parameters:
        in - original input stream
        Returns:
        input stream like in but with a DOCTYPE
        Throws:
        java.lang.IllegalStateException - if this method has already been called on this object
        java.io.IOException
      • getVotableVersion

        public java.lang.String getVotableVersion()
        Returns the value of the version attribute of the top-level VOTABLE element, if there was one and it was encountered.
        Returns:
        declared VOTable version string, or null
      • message

        public void message​(java.lang.String msg)
        Presents a processing message.
        Parameters:
        msg - message text
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Filter program which takes a stream on standard output and writes to standard output including the DOCTYPE.
        Throws:
        java.io.IOException