Class AbstractDescriptorIo

    • Constructor Detail

      • AbstractDescriptorIo

        protected AbstractDescriptorIo​(DescriptorType descriptorType)
        Constructor.
        Parameters:
        descriptorType - the descriptor type.
    • Method Detail

      • createDocumentBuilder

        public org.jdom2.input.SAXBuilder createDocumentBuilder()
        Create a document builder.
        Specified by:
        createDocumentBuilder in interface DescriptorIo
        Returns:
        new document builder
      • createDocumentBuilder

        public org.jdom2.input.SAXBuilder createDocumentBuilder​(EntityResolver theEntityResolver)
        Specified by:
        createDocumentBuilder in interface DescriptorIo
        Parameters:
        theEntityResolver - entity resolver or null
        Returns:
        a new non-validating, non-namespace-aware DocumentBuilder instance
      • getEntityResolver

        protected EntityResolver getEntityResolver()
        Get the default entity resolver for this type.
        Returns:
        default resolver, or null if none
      • parseXml

        public org.jdom2.Document parseXml​(InputStream input)
                                    throws org.jdom2.JDOMException,
                                           IOException
        Description copied from interface: DescriptorIo
        Parse XML into a document.
        Specified by:
        parseXml in interface DescriptorIo
        Parameters:
        input - the input stream
        Returns:
        JDOM Document
        Throws:
        IOException - if problem reading the stream
        org.jdom2.JDOMException - if problem parsing the stream
      • parseXml

        public org.jdom2.Document parseXml​(InputStream input,
                                           EntityResolver resolver)
                                    throws org.jdom2.JDOMException,
                                           IOException
        Create a document from the input stream and resolver.
        Specified by:
        parseXml in interface DescriptorIo
        Parameters:
        input - the input stream
        resolver - entity resolver, or null
        Returns:
        JDOM Document
        Throws:
        IOException - if problem reading the stream
        org.jdom2.JDOMException - if problem parsing the stream
      • writeDescriptor

        public static void writeDescriptor​(Descriptor descriptor,
                                           File file)
                                    throws IOException
        Writes the specified document to a file.
        Parameters:
        descriptor - The descriptor to serialize
        file - The file to write to
        Throws:
        IOException - If an I/O error occurs
      • writeDescriptor

        public static void writeDescriptor​(Descriptor descriptor,
                                           File file,
                                           Charset encoding)
                                    throws IOException
        Writes the specified document to a file.
        Parameters:
        descriptor - The descriptor to serialize
        file - The file to write to
        encoding - The character encoding to use
        Throws:
        IOException - If an I/O error occurs
      • writeDescriptor

        public static void writeDescriptor​(Descriptor descriptor,
                                           File file,
                                           Charset encoding,
                                           boolean isIndent)
                                    throws IOException
        Writes the specified document to a file.
        Parameters:
        descriptor - The descriptor to serialize
        file - The file to write to
        encoding - The character encoding to use
        isIndent - Whether the written XML should be indented
        Throws:
        IOException - If an I/O error occurs
      • writeDescriptor

        public static void writeDescriptor​(Descriptor descriptor,
                                           OutputStream out,
                                           Charset encoding,
                                           boolean isIndent)
                                    throws IOException
        Writes the specified document to an output stream.
        Parameters:
        descriptor - The descriptor to serialize
        out - The output stream to write to
        encoding - The character encoding to use
        isIndent - Whether the written XML should be indented
        Throws:
        IOException - If an I/O error occurs
      • writeAll

        public static File[] writeAll​(J2eeDescriptor descriptor,
                                      String dir)
                               throws IOException
        Writes the WebXml and its associated vendor descriptors to the specified directory.
        Parameters:
        descriptor - The descriptor to serialize
        dir - Directory to store the descriptors in
        Returns:
        Array of files for every created file
        Throws:
        IOException - if a I/O error occurs