Package 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 toread(InputStream)
and one that will use a parser pool. Use of a parser pool is recommended.
-
-
Constructor Summary
Constructors Constructor Description EPPXMLByteArray()
Default constructor forEPPXMLByteArray
.EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends javax.xml.parsers.DocumentBuilder> aParserPool)
ConstructEPPXMLByteArray
to use a parser pool and a default transformer pool.EPPXMLByteArray(org.apache.commons.pool2.BaseObjectPool<? extends javax.xml.parsers.DocumentBuilder> aParserPool, org.apache.commons.pool2.BaseObjectPool<? extends javax.xml.transform.Transformer> aTransformerPool)
ConstructEPPXMLByteArray
to use a parser pool and a transformer pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.Document
decode(byte[] aPacket)
Decodes(parses) and validates theaPacket
parameter and returns the associated DOM Document.byte[]
encode(org.w3c.dom.Document aDoc)
Encodes(converts) a DOM Document to abyte
array.
-
-
-
Constructor Detail
-
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 javax.xml.parsers.DocumentBuilder> aParserPool)
ConstructEPPXMLByteArray
to use a parser pool and a default transformer pool. TheaParserPoolName
parameter has to be a pool ofEPPParserPool
subclasses. When using this constructor, a parser instance will be checked out and checked in as needed on each call todecode(byte[])
. TheEPPTransformerPool
is 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 javax.xml.parsers.DocumentBuilder> aParserPool, org.apache.commons.pool2.BaseObjectPool<? extends javax.xml.transform.Transformer> aTransformerPool)
ConstructEPPXMLByteArray
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 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 Detail
-
decode
public org.w3c.dom.Document decode(byte[] aPacket) throws EPPAssemblerException, EPPException, java.io.IOException
Decodes(parses) and validates theaPacket
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 packetjava.io.IOException
- Error reading packet from stream
-
encode
public byte[] encode(org.w3c.dom.Document aDoc) throws EPPException
Encodes(converts) a DOM Document to abyte
array. The DOM Document will be serialized to XML and converted into abyte
array.- Parameters:
aDoc
- DOM Document to convert tobyte
array.- Returns:
- Encoded XML as a
byte[]
from the DOMDocument
. - Throws:
EPPException
- Error writing to stream. It is recommended that the stream be closed.
-
-