Package com.verisign.epp.util
Class EPPXMLByteArray
java.lang.Object
com.verisign.epp.util.EPPXMLByteArray
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
ConstructorsConstructorDescriptionDefault constructor forEPPXMLByteArray.EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool) ConstructEPPXMLByteArrayto 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) ConstructEPPXMLByteArrayto use a parser pool and a transformer pool. -
Method Summary
-
Constructor Details
-
EPPXMLByteArray
public EPPXMLByteArray()Default constructor forEPPXMLByteArray. When using this constructor, a parser instance will be created on each call todecode(byte[])and a transformer instance will be created on each call toencode(). . -
EPPXMLByteArray
public EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends DocumentBuilder> aParserPool) ConstructEPPXMLByteArrayto use a parser pool and a default transformer pool. TheaParserPoolNameparameter has to be a pool ofEPPParserPoolsubclasses. When using this constructor, a parser instance will be checked out and checked in as needed on each call todecode(byte[]). TheEPPTransformerPoolis used by default for the transformer pool when usingencode(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) ConstructEPPXMLByteArrayto 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 todecode(byte[])and a transformer instance will be checked out and checked in as needed on each call toencode(Document).- Parameters:
aParserPool- Parser pool to useaTransformerPool- Transformer pool to use
-
-
Method Details
-
decode
Decodes(parses) and validates theaPacketparameter 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 packetIOException- Error reading packet from stream
-
encode
Encodes(converts) a DOM Document to abytearray. The DOM Document will be serialized to XML and converted into abytearray.- Parameters:
aDoc- DOM Document to convert tobytearray.- Returns:
- Encoded XML as a
byte[]from the DOMDocument. - Throws:
EPPException- Error writing to stream. It is recommended that the stream be closed.
-