Package com.composum.sling.core.util
Class ValueEmbeddingWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- com.composum.sling.core.util.ValueEmbeddingWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class ValueEmbeddingWriter extends FilterWriter
a filter writer implementation to embed values from a value map for written placeholders
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classValueEmbeddingWriter.TextWriterprotected classValueEmbeddingWriter.ValueWriter
-
Field Summary
Fields Modifier and Type Field Description protected booleankeepUnresolvableprotected Localelocaleprotected ResourceBundleresourceBundleprotected Class<?>resourceContextprotected org.apache.sling.api.resource.ValueMapvaluesprotected WriterwrappedWriterprotected Stack<com.composum.sling.core.util.ValueEmbeddingWriter.TokenWriter>writerStack-
Fields inherited from class java.io.FilterWriter
out
-
-
Constructor Summary
Constructors Constructor Description ValueEmbeddingWriter(@NotNull Writer writer, @NotNull Map<String,Object> values)Creates a tag filtering reader to filter out the tags configured as sets of tag namesValueEmbeddingWriter(@NotNull Writer writer, @NotNull Map<String,Object> values, @Nullable Locale locale, @Nullable Class<?> resourceContext)Creates a tag filtering reader to filter out the tags configured as sets of tag namesValueEmbeddingWriter(@NotNull Writer writer, @NotNull Map<String,Object> values, @Nullable Locale locale, @Nullable Class<?> resourceContext, @Nullable ResourceBundle resourceBundle)Creates a tag filtering reader to filter out the tags configured as sets of tag names
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()booleanisKeepUnresolvable(boolean... decision)voidpass(char[] cbuf, int off, int len)voidpass(int chr)voidpass(String str)voidpass(String str, int off, int len)voidwrite(char[] cbuf, int off, int len)uses the single token read() method to fill the buffervoidwrite(int token)voidwrite(String str, int off, int len)-
Methods inherited from class java.io.FilterWriter
close
-
-
-
-
Field Detail
-
wrappedWriter
protected final Writer wrappedWriter
-
values
protected final org.apache.sling.api.resource.ValueMap values
-
locale
protected final Locale locale
-
resourceContext
protected final Class<?> resourceContext
-
resourceBundle
protected final ResourceBundle resourceBundle
-
keepUnresolvable
protected boolean keepUnresolvable
-
writerStack
protected final Stack<com.composum.sling.core.util.ValueEmbeddingWriter.TokenWriter> writerStack
-
-
Constructor Detail
-
ValueEmbeddingWriter
public ValueEmbeddingWriter(@NotNull @NotNull Writer writer, @NotNull @NotNull Map<String,Object> values)Creates a tag filtering reader to filter out the tags configured as sets of tag names- Parameters:
writer- the writer to filtervalues- the set of available placeholders
-
ValueEmbeddingWriter
public ValueEmbeddingWriter(@NotNull @NotNull Writer writer, @NotNull @NotNull Map<String,Object> values, @Nullable @Nullable Locale locale, @Nullable @Nullable Class<?> resourceContext)Creates a tag filtering reader to filter out the tags configured as sets of tag names- Parameters:
writer- the writer to filtervalues- the set of available placeholderslocale- the locale to use for value formattingresourceContext- the context class for resource loading
-
ValueEmbeddingWriter
public ValueEmbeddingWriter(@NotNull @NotNull Writer writer, @NotNull @NotNull Map<String,Object> values, @Nullable @Nullable Locale locale, @Nullable @Nullable Class<?> resourceContext, @Nullable @Nullable ResourceBundle resourceBundle)Creates a tag filtering reader to filter out the tags configured as sets of tag names- Parameters:
writer- the writer to filtervalues- the set of available placeholderslocale- the locale to use for value formattingresourceContext- the context class for resource loadingresourceBundle- the translations bundle (switches translation on)
-
-
Method Detail
-
isKeepUnresolvable
public boolean isKeepUnresolvable(boolean... decision)
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterWriter- Throws:
IOException
-
write
public void write(int token) throws IOException- Overrides:
writein classFilterWriter- Throws:
IOException
-
write
public void write(String str, int off, int len) throws IOException
- Overrides:
writein classFilterWriter- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOExceptionuses the single token read() method to fill the buffer- Overrides:
writein classFilterWriter- Throws:
IOException
-
pass
public void pass(String str) throws IOException
- Throws:
IOException
-
pass
public void pass(String str, int off, int len) throws IOException
- Throws:
IOException
-
pass
public void pass(char[] cbuf, int off, int len) throws IOException- Throws:
IOException
-
pass
public void pass(int chr) throws IOException- Throws:
IOException
-
-