Class EPPXMLByteArray

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

public class EPPXMLByteArray extends 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
    Description
    Default constructor for EPPXMLByteArray.
    EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool)
    Construct EPPXMLByteArray to use a parser pool and a default transformer pool.
    EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool, org.apache.commons.pool2.BaseObjectPool<? extends Transformer> aTransformerPool)
    Construct EPPXMLByteArray to use a parser pool and a transformer pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(byte[] aPacket)
    Decodes(parses) and validates the aPacket parameter and returns the associated DOM Document.
    byte[]
    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 Details

    • 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(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool)
      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 checked in as needed on each call to decode(byte[]). The EPPTransformerPool is used by default for the transformer pool when using encode(Document).
      Parameters:
      aParserPool - Parser pool to use
    • EPPXMLByteArray

      public EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool, org.apache.commons.pool2.BaseObjectPool<? extends Transformer> aTransformerPool)
      Construct EPPXMLByteArray to use a parser pool and a transformer pool. When using this constructor, a parser instance will be checked out and checked in as needed on each call to decode(byte[]) and a transformer instance will be checked out and checked in as needed on each call to encode(Document).
      Parameters:
      aParserPool - Parser pool to use
      aTransformerPool - Transformer pool to use
  • Method Details

    • decode

      public Document decode(byte[] aPacket) throws EPPAssemblerException, EPPException, 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. 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
      IOException - Error reading packet from stream
    • encode

      public byte[] encode(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.