public class NlsWriter extends AppendableWriter
NlsWriter is a Writer, that writes the
localized message of the given text. In other words everything that is
written here (except via printRaw(CharSequence) and printlnRaw(CharSequence)) gets translated via
NlsMessage.| Modifier and Type | Field and Description |
|---|---|
private Map<String,Object> |
arguments |
private Locale |
locale
The
Locale to translate to. |
private NlsMessageFactory |
messageFactory
The
NlsMessageFactory. |
private String |
newline
The string used to terminate a line.
|
private NlsTemplateResolver |
resolver
The
NlsTemplateResolver. |
| Constructor and Description |
|---|
NlsWriter(Appendable appendable)
The constructor.
|
NlsWriter(Appendable appendable,
Map<String,Object> arguments)
The constructor.
|
NlsWriter(Appendable appendable,
Map<String,Object> arguments,
Locale locale)
The constructor.
|
NlsWriter(Appendable appendable,
Map<String,Object> arguments,
Locale locale,
String newline)
The constructor.
|
NlsWriter(Appendable appendable,
Map<String,Object> arguments,
Locale locale,
String newline,
NlsMessageFactory messageFactory)
The constructor.
|
NlsWriter(Appendable appendable,
Map<String,Object> arguments,
Locale locale,
String newline,
NlsMessageFactory messageFactory,
NlsTemplateResolver resolver)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NlsWriter |
append(CharSequence csq) |
NlsWriter |
append(CharSequence csq,
int start,
int end) |
Map<String,Object> |
getArguments()
This method gets the
arguments for the created NlsMessage s. |
void |
print(CharSequence csq)
This method is the same as
append(CharSequence) or AppendableWriter.write(String). |
void |
print(NlsMessage message)
This method writes an
NlsMessage. |
void |
println()
This method writes a newline (line-separator).
|
void |
println(CharSequence csq)
This method is like
append(CharSequence) or AppendableWriter.write(String) but additionally adds a newline
(line-separator) after the message. |
void |
printlnRaw(CharSequence text)
This method
writes the raw text without internationalization. |
void |
printRaw(CharSequence text)
This method
writes the raw text without internationalization. |
void |
setArguments(Map<String,Object> arguments)
This method sets the
arguments. |
append, close, flush, getAppendable, write, write, write, writeprivate final NlsMessageFactory messageFactory
NlsMessageFactory.private final String newline
private final NlsTemplateResolver resolver
NlsTemplateResolver.public NlsWriter(Appendable appendable)
appendable - is the Appendable to delegate to.public NlsWriter(Appendable appendable, Map<String,Object> arguments)
appendable - is the Appendable to delegate to.arguments - are the arguments.public NlsWriter(Appendable appendable, Map<String,Object> arguments, Locale locale)
appendable - is the Appendable to delegate to.arguments - are the arguments.locale - is the Locale.public NlsWriter(Appendable appendable, Map<String,Object> arguments, Locale locale, String newline)
appendable - is the Appendable to delegate to.arguments - are the arguments.locale - is the Locale.newline - is the line-separator.public NlsWriter(Appendable appendable, Map<String,Object> arguments, Locale locale, String newline, NlsMessageFactory messageFactory)
appendable - is the Appendable to delegate to.arguments - are the arguments.locale - is the Locale.newline - is the line-separator.messageFactory - is the NlsMessageFactory.public NlsWriter(Appendable appendable, Map<String,Object> arguments, Locale locale, String newline, NlsMessageFactory messageFactory, NlsTemplateResolver resolver)
appendable - is the Appendable to delegate to.arguments - are the arguments.locale - is the Locale.newline - is the line-separator.messageFactory - is the NlsMessageFactory.resolver - is the NlsTemplateResolver to use.public NlsWriter append(CharSequence csq, int start, int end) throws RuntimeIoException
append in interface Appendableappend in class AppendableWriterRuntimeIoExceptionpublic NlsWriter append(CharSequence csq) throws RuntimeIoException
append in interface Appendableappend in class AppendableWriterRuntimeIoExceptionpublic void print(CharSequence csq) throws RuntimeIoException
append(CharSequence) or AppendableWriter.write(String).csq - is the internationalized message to write.RuntimeIoException - if an error occurred while writing.public void print(NlsMessage message) throws RuntimeIoException
NlsMessage.message - is the NlsMessage to write.RuntimeIoException - if an error occurred while writing.public void println()
throws RuntimeIoException
RuntimeIoException - if an error occurred while writing.public void println(CharSequence csq) throws RuntimeIoException
append(CharSequence) or AppendableWriter.write(String) but additionally adds a newline
(line-separator) after the message.csq - is the internationalized message to write.RuntimeIoException - if an error occurred while writing.public void printRaw(CharSequence text) throws RuntimeIoException
writes the raw text without internationalization. It may be used for
text that is language independent or already internationalized.text - is the raw text to write.RuntimeIoException - if an IOException occurred while writing to the underlying Appendable.public void printlnRaw(CharSequence text) throws RuntimeIoException
writes the raw text without internationalization. It may be used for
text that is language independent or already internationalized.text - is the raw text to write.RuntimeIoException - if an IOException occurred while writing to the underlying Appendable.public Map<String,Object> getArguments()
arguments for the created NlsMessage s. The
arguments may be modified or replaced before the next message is written.Copyright © 2001–2016 mmm-Team. All rights reserved.