Package org.codehaus.stax2.io
Class Stax2Result
- java.lang.Object
-
- org.codehaus.stax2.io.Stax2Result
-
- All Implemented Interfaces:
Result
- Direct Known Subclasses:
Stax2BlockResult
,Stax2ReferentialResult
public abstract class Stax2Result extends Object implements Result
This is the base class for additional output results (implementations ofResult
) that Stax2XMLInputFactory2
implementations should support.Note about usage by the parser factory implementations: the expectation is that at least one of methods
constructWriter()
andconstructOutputStream()
will succeed, but not necessarily both. This generally depends on type of resource being represented: for example, if the source is a StringBuffer, it is most naturally represent viaWriter
. For File-backed results, on the other hand, anOutputStream
is the most natural access method.Other things to note about using result
Writer
s andOutputStream
s:- Caller is responsible for closing any
Writer
andOutputStream
instances requested. That is, caller owns these accessor objects. - Result objects are only required to return a non-null object once: after this, if new non-null instances are returned, they must not be the same objects as returned earlier. Implementations can choose to construct new instances to the same backing data structure or resource; if so, they should document this behavior.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
mEncoding
protected String
mPublicId
protected String
mSystemId
-
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Stax2Result()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract OutputStream
constructOutputStream()
This method creates anOutputStream
via which underlying output target can be written to.abstract Writer
constructWriter()
This method creates aWriter
via which underlying output target can be written to.String
getEncoding()
String
getPublicId()
String
getSystemId()
void
setEncoding(String enc)
void
setPublicId(String id)
void
setSystemId(String id)
-
-
-
Method Detail
-
getSystemId
public String getSystemId()
- Specified by:
getSystemId
in interfaceResult
-
setSystemId
public void setSystemId(String id)
- Specified by:
setSystemId
in interfaceResult
-
getPublicId
public String getPublicId()
-
setPublicId
public void setPublicId(String id)
-
getEncoding
public String getEncoding()
-
setEncoding
public void setEncoding(String enc)
-
constructWriter
public abstract Writer constructWriter() throws IOException
This method creates aWriter
via which underlying output target can be written to. Note that caller is responsible for closing that Writer when it is done reading it.- Throws:
IOException
-
constructOutputStream
public abstract OutputStream constructOutputStream() throws IOException
This method creates anOutputStream
via which underlying output target can be written to. Note that caller is responsible for closing that OutputStream when it is done reading it- Throws:
IOException
-
-