SerializerFactoryImplpublic final class SerializerFactoryImpl extends SerializerFactory Default serializer factory can construct serializers for the three
markup serializers (XML, HTML, XHTML ). |
Fields Summary |
---|
private String | _method |
Constructors Summary |
---|
SerializerFactoryImpl(String method)
_method = method;
if ( ! _method.equals( Method.XML ) &&
! _method.equals( Method.HTML ) &&
! _method.equals( Method.XHTML ) &&
! _method.equals( Method.TEXT ) ) {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, "MethodNotSupported", new Object[]{method});
throw new IllegalArgumentException(msg);
}
|
Methods Summary |
---|
private Serializer | getSerializer(OutputFormat format)
if ( _method.equals( Method.XML ) ) {
return new XMLSerializer( format );
} else if ( _method.equals( Method.HTML ) ) {
return new HTMLSerializer( format );
} else if ( _method.equals( Method.XHTML ) ) {
return new XHTMLSerializer( format );
} else if ( _method.equals( Method.TEXT ) ) {
return new TextSerializer();
} else {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, "MethodNotSupported", new Object[]{_method});
throw new IllegalStateException(msg);
}
| protected java.lang.String | getSupportedMethod()
return _method;
| public Serializer | makeSerializer(OutputFormat format)
Serializer serializer;
serializer = getSerializer( format );
serializer.setOutputFormat( format );
return serializer;
| public Serializer | makeSerializer(java.io.Writer writer, OutputFormat format)
Serializer serializer;
serializer = getSerializer( format );
serializer.setOutputCharStream( writer );
return serializer;
| public Serializer | makeSerializer(java.io.OutputStream output, OutputFormat format)
Serializer serializer;
serializer = getSerializer( format );
serializer.setOutputByteStream( output );
return serializer;
|
|