com.verisign.epp.util

## Class EPPXMLByteArray

- java.lang.Object
- - com.verisign.epp.util.EPPXMLByteArray

-     public class EPPXMLByteArray
      extends java.lang.Object

  `EPPXMLByteArray` is a utility class for reading and writing EPP messages to/from byte arrays. DOM Document is converted to and from byte arrays. An XML parser is required when reading from the stream. There is one constructor that will create an XML parser per call to `read(InputStream)` and one that will use a parser pool. Use of a parser pool is recommended.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPXMLByteArray()` Default constructor for `EPPXMLByteArray`.
    `EPPXMLByteArray(java.lang.String aParserPoolName)` Construct `EPPXMLByteArray` to use a parser pool and a default transformer pool.
    `EPPXMLByteArray(java.lang.String aParserPoolName, java.lang.String aTransformerPoolName)` Construct `EPPXMLByteArray` to use a parser pool and a transformer pool.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.w3c.dom.Document` | `decode(byte[] aPacket)` Decodes(parses) and validates the `aPacket` parameter and returns the associated DOM Document.
    `byte[]` | `encode(org.w3c.dom.Document aDoc)` Encodes(converts) a DOM Document to a `byte` array.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EPPXMLByteArray

          public EPPXMLByteArray()

      Default constructor for `EPPXMLByteArray`. When using this constructor, a parser instance will be created on each call to `decode(byte[])` and a transformer instance will be created on each call to `encode()`. .

    - #### EPPXMLByteArray

          public EPPXMLByteArray(java.lang.String aParserPoolName)

      Construct `EPPXMLByteArray` to use a parser pool and a default transformer pool. The `aParserPoolName` parameter has to be a pool of `EPPParserPool` subclasses. When using this constructor, a parser instance will be checked out and checkin as needed on each call to `decode(byte[])`. The `Transformer` pool used is defined by the `EPPTransformer.POOL` constant.
      Parameters:
        `aParserPoolName` - Pool name to use

    - #### EPPXMLByteArray

          public EPPXMLByteArray(java.lang.String aParserPoolName,
                                 java.lang.String aTransformerPoolName)

      Construct `EPPXMLByteArray` to use a parser pool and a transformer pool. The `aParserPoolName` parameter has to be a pool of `EPPParserPool` subclasses. When using this constructor, a parser instance will be checked out and checkin as needed on each call to `decode(byte[])`. The `Transformer` pool used is defined by the `EPPTransformer.POOL` constant. The `aTransformerPoolName` parameters is the name of pool containing `Transformer` instances.
      Parameters:
        `aParserPoolName` - Parser pool name to use
        `aTransformerPoolName` - Transformer pool name to use

  - ### Method Detail

    - #### decode

          public org.w3c.dom.Document decode(byte[] aPacket)
                                      throws EPPAssemblerException,
                                             EPPException,
                                             java.io.IOException

      Decodes(parses) and validates the `aPacket` parameter and returns the associated DOM Document. The XML parser is either created per call, or is retrieved from a parser pool when `EPPXMLByteArray(GenericPoolManager)` is used. Use of a parser pool is recommended.
      Parameters:
        `aPacket` - The byte array containing the EPP packet.
      Returns:
        Parsed DOM Document of packet
      Throws:
        `EPPException` - Error with received packet or end of stream. It is recommended that the stream be closed.
        `EPPAssemblerException` - Error parsing packet
        `java.io.IOException` - Error reading packet from stream

    - #### encode

          public byte[] encode(org.w3c.dom.Document aDoc)
                        throws EPPException

      Encodes(converts) a DOM Document to a `byte` array. The DOM Document will be serialized to XML and converted into a `byte` array.
      Parameters:
        `aDoc` - DOM Document to convert to `byte` array.
      Returns:
        Encoded XML as a `byte[]` from the DOM `Document`.
      Throws:
        `EPPException` - Error writing to stream. It is recommended that the stream be closed.