Class DTDWriter


  • final class DTDWriter
    extends java.lang.Object
    Simple utility class used by DTDReader when writing out flattened external DTD subset file. Writing functionality encapsulated here since it's specific to one mode of operation (flattening).

    Note, too, that underlying IOExceptions are generally wrapped as XMLStreamExceptions. This is needed to reduce amount of work caller has to do for wrapping. It will still be possible to unwrap these exceptions further up the call stack if need be.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int mFlattenStart
      Pointer to first character in the current input buffer that has not yet been written to flatten writer.
      (package private) boolean mIncludeComments  
      (package private) boolean mIncludeConditionals  
      (package private) boolean mIncludePEs  
      (package private) int mIsFlattening
      Counter that indicates whether flattened output should be written to (non-null) mWriter; values above zero indicate output is enabled, zero and below that output is disabled.
      (package private) java.io.Writer mWriter  
    • Constructor Summary

      Constructors 
      Constructor Description
      DTDWriter​(java.io.Writer out, boolean inclComments, boolean inclCond, boolean inclPEs)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void disableOutput()  
      void enableOutput​(int newStart)  
      void flush​(char[] buf, int upUntil)  
      int getFlattenStart()  
      boolean includeComments()  
      boolean includeConditionals()  
      boolean includeParamEntities()  
      void output​(char c)  
      void output​(java.lang.String output)
      Method called when explicit output has to be done for flatten output: this is usually done when there's need to do speculative checks before it's known if some chars are output (when suppressing comments or conditional sections)
      void setFlattenStart​(int ptr)  
      • Methods inherited from class java.lang.Object

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

      • mWriter

        final java.io.Writer mWriter
      • mIncludeComments

        final boolean mIncludeComments
      • mIncludeConditionals

        final boolean mIncludeConditionals
      • mIncludePEs

        final boolean mIncludePEs
      • mIsFlattening

        int mIsFlattening
        Counter that indicates whether flattened output should be written to (non-null) mWriter; values above zero indicate output is enabled, zero and below that output is disabled. Only enabled if mWriter is not null; will be temporarily disabled during processing of content that is not to be included (PE reference; or comments / conditional sections if comment/cs output is suppressed)
      • mFlattenStart

        int mFlattenStart
        Pointer to first character in the current input buffer that has not yet been written to flatten writer.
    • Constructor Detail

      • DTDWriter

        public DTDWriter​(java.io.Writer out,
                         boolean inclComments,
                         boolean inclCond,
                         boolean inclPEs)
    • Method Detail

      • includeComments

        public boolean includeComments()
      • includeConditionals

        public boolean includeConditionals()
      • includeParamEntities

        public boolean includeParamEntities()
      • disableOutput

        public void disableOutput()
      • enableOutput

        public void enableOutput​(int newStart)
      • setFlattenStart

        public void setFlattenStart​(int ptr)
      • getFlattenStart

        public int getFlattenStart()
      • flush

        public void flush​(char[] buf,
                          int upUntil)
                   throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • output

        public void output​(java.lang.String output)
                    throws javax.xml.stream.XMLStreamException
        Method called when explicit output has to be done for flatten output: this is usually done when there's need to do speculative checks before it's known if some chars are output (when suppressing comments or conditional sections)
        Throws:
        javax.xml.stream.XMLStreamException
      • output

        public void output​(char c)
                    throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException