org.mmbase.util.transformers
Class Javascript

java.lang.Object
  extended byorg.mmbase.util.transformers.ReaderTransformer
      extended byorg.mmbase.util.transformers.ConfigurableReaderTransformer
          extended byorg.mmbase.util.transformers.Javascript
All Implemented Interfaces:
CharTransformer, ConfigurableTransformer, Serializable, Transformer

public class Javascript
extends ConfigurableReaderTransformer
implements CharTransformer

Encodings related Javascript It can escape single quotes, by replacing them by \\', as is needed in document.write actions.

Since:
MMBase-1.7.4
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
static int ESCAPE_DOUBLE_QUOTES
           
static int ESCAPE_SINGLE_QUOTES
           
 
Fields inherited from class org.mmbase.util.transformers.ConfigurableReaderTransformer
to
 
Constructor Summary
Javascript()
           
Javascript(int conf)
           
 
Method Summary
static Writer escapeChar(Reader r, Writer w, char escapeChar)
          Escapes a quote
static Writer escapeCharBack(Reader r, Writer w)
          Unescapes \-escapes in a string.
 String getEncoding()
          Returns the encoding that is currently active
 Writer transform(Reader r, Writer w)
           
 Writer transformBack(Reader r, Writer w)
           
 Map transformers()
          Used when registering this class as a possible Transformer
 
Methods inherited from class org.mmbase.util.transformers.ConfigurableReaderTransformer
configure, toString
 
Methods inherited from class org.mmbase.util.transformers.ReaderTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.transformers.CharTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from interface org.mmbase.util.transformers.Transformer
toString
 

Field Detail

ESCAPE_SINGLE_QUOTES

public static final int ESCAPE_SINGLE_QUOTES
See Also:
Constant Field Values

ESCAPE_DOUBLE_QUOTES

public static final int ESCAPE_DOUBLE_QUOTES
See Also:
Constant Field Values
Constructor Detail

Javascript

public Javascript()

Javascript

public Javascript(int conf)
Method Detail

escapeChar

public static Writer escapeChar(Reader r,
                                Writer w,
                                char escapeChar)
Escapes a quote

Parameters:
escapeChar - The quote character to be escaped.
Returns:
the writer

escapeCharBack

public static Writer escapeCharBack(Reader r,
                                    Writer w)
Unescapes \-escapes in a string.


transformers

public Map transformers()
Used when registering this class as a possible Transformer

Specified by:
transformers in interface ConfigurableTransformer
Specified by:
transformers in class ConfigurableReaderTransformer

transform

public Writer transform(Reader r,
                        Writer w)
Specified by:
transform in interface CharTransformer
Specified by:
transform in class ReaderTransformer

transformBack

public Writer transformBack(Reader r,
                            Writer w)
Specified by:
transformBack in interface CharTransformer
Overrides:
transformBack in class ReaderTransformer

getEncoding

public String getEncoding()
Description copied from interface: ConfigurableTransformer
Returns the encoding that is currently active

Specified by:
getEncoding in interface ConfigurableTransformer
Specified by:
getEncoding in class ConfigurableReaderTransformer


MMBase build 1.8.1.20060716