public class EPPXMLStream
extends java.lang.Object
EPPXMLStream
is a utility class for reading and writing EPP
messages to/from streams. DOM Document are read and written to the streams.
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.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_PACKET_SIZE
Default Maximum packet size of bytes accepted to ensure that the client is
not overrun with an invalid packet or a packet that exceeds the maximum
size.
|
Constructor and Description |
---|
EPPXMLStream()
Default constructor for
EPPXMLStream . |
EPPXMLStream(java.lang.String aParserPoolName)
Construct
EPPXMLStream to use a parser pool and a default
transformer pool. |
EPPXMLStream(java.lang.String aParserPoolName,
java.lang.String aTransformerPoolName)
Construct
EPPXMLStream to use a parser pool and a transformer
pool. |
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Document |
decodePacket(byte[] aPacket)
Decodes the passed in packet
byte[] into a DOM
Document . |
org.w3c.dom.Document |
read(java.io.InputStream aStream)
Reads an EPP packet from the
aStream parameter,
parses/validates it, and returns the associated DOM Document. |
byte[] |
readPacket(java.io.InputStream aStream)
Reads an EPP packet from the stream based on a search for the End Of
Message (EOM) string (</epp>).
|
void |
write(org.w3c.dom.Document aDoc,
java.io.OutputStream aOutput,
EPPMessage aMessage)
Writes a DOM Document to the output stream.
|
void |
writePacket(byte[] aPacket,
java.io.OutputStream aOutput)
Writes a packet to the output stream with the inclusion of the EPP four
byte header.
|
void |
writePacket(byte[] aPacket,
java.io.OutputStream aOutput,
EPPMessage aMessage)
Writes a packet to the output stream with the inclusion of the EPP four
byte header.
|
public static final int DEFAULT_MAX_PACKET_SIZE
public EPPXMLStream()
EPPXMLStream
. When using this
constructor, a parser instance will be created on each call to
read(InputStream)
and a transformer instance will be created
on each call to write(Document,OutputStream)
. .public EPPXMLStream(java.lang.String aParserPoolName)
EPPXMLStream
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 read(InputStream)
. The
Transformer
pool used is defined by the
EPPTransformer.POOL
constant.aParserPoolName
- Parser pool name to usepublic EPPXMLStream(java.lang.String aParserPoolName, java.lang.String aTransformerPoolName)
EPPXMLStream
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
read(InputStream)
. The Transformer
pool used is
defined by the EPPTransformer.POOL
constant. The
aTransformerPoolName
parameters is the name of pool
containing Transformer
instances.aParserPoolName
- Parser pool name to useaTransformerPoolName
- Transformer pool name to usepublic byte[] readPacket(java.io.InputStream aStream) throws EPPException, java.io.InterruptedIOException, java.io.IOException
aStream
- Stream to read packet fromString
EPPException
- Error reading packet from stream. The stream should be
closed.java.io.InterruptedIOException
- Time out reading for packetjava.io.IOException
- Exception from the input streampublic org.w3c.dom.Document read(java.io.InputStream aStream) throws EPPAssemblerException, EPPException, java.io.IOException
aStream
parameter,
parses/validates it, and returns the associated DOM Document. The XML
parser is either created per call, or is retrieved from a parser pool when
EPPXMLStream(GenericPoolManager)
is used. Use of a parser
pool is recommended.aStream
- Input stream to read for an EPP packet.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 streampublic org.w3c.dom.Document decodePacket(byte[] aPacket) throws EPPException, java.io.IOException
byte[]
into a DOM
Document
.aPacket
- Input packet to decode to DOM Document
.Document
EPPException
- Error decoding the packet.java.io.IOException
- Basic IO error decoding the packet.public void writePacket(byte[] aPacket, java.io.OutputStream aOutput, EPPMessage aMessage) throws java.io.IOException
aPacket
- Packet to write to the output streamaOutput
- Output stream to write the packet toaMessage
- Message object associated with the packet that can be used for
filtering the information written to the packet log. Passing
null
may not filter or may cause performance issues
in filtering the log information.java.io.IOException
- Error writing the packet to the output streampublic void writePacket(byte[] aPacket, java.io.OutputStream aOutput) throws java.io.IOException
aPacket
- Packet to write to the output streamaOutput
- Output stream to write the packet tojava.io.IOException
- Error writing the packet to the output streampublic void write(org.w3c.dom.Document aDoc, java.io.OutputStream aOutput, EPPMessage aMessage) throws EPPException
aDoc
- DOM Document to write to streamaOutput
- Output stream to write toaMessage
- EPPMessage
associated with aDoc
that
is used for packet logging logic. Set to null
if
unavailable.EPPException
- Error writing to stream. It is recommended that the stream
be closed.Copyright © VeriSign Inc. All Rights Reserved.