Class InetHtmlWriter

  extended by javax.swing.text.AbstractWriter
      extended by com.inet.html.InetHtmlWriter

public class InetHtmlWriter
extends javax.swing.text.AbstractWriter

Write the InetHtmlDocument as text/plain. Some protected method have the same signature like the Sun javax.swing.text.html.HTMLWriter to make it easer to port to this implementation.
As a 'special feature' this writer can replace image source links, which is useful for e-mails for instance.

Constructor Summary
InetHtmlWriter( out, javax.swing.text.Document doc, int pos, int len)
          Create a new HTM4Writer
Method Summary
 int getEndOffset()
 void registerImageSRCreplace(java.util.Map<java.lang.String,java.lang.String> imageReplaceMap)
          Registers an image SRC replace map at this writer.
 void setInlineMode(boolean inlineMode)
          Sets the writer to inline-CSS mode.
static void setSorted(boolean sorted)
          Enable or disable the attribute sorting of the writer.
 void write()
Methods inherited from class javax.swing.text.AbstractWriter
getLineSeparator, getStartOffset, setLineSeparator
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public InetHtmlWriter( out,
                      javax.swing.text.Document doc,
                      int pos,
                      int len)
Create a new HTM4Writer

out - any Writer
doc - a HTML4Document
pos - the start position of the document that should be written.
len - the length of data that should be written
Method Detail


public void write()
           throws javax.swing.text.BadLocationException,

Specified by:
write in class javax.swing.text.AbstractWriter


public void registerImageSRCreplace(java.util.Map<java.lang.String,java.lang.String> imageReplaceMap)
Registers an image SRC replace map at this writer. If the SRC-location of an image element is registered in this map it will be replaced before it is written. Useful to redirect image locations for embedded images.

imageReplaceMap - Key=original location, Value=new location


public int getEndOffset()

getEndOffset in class javax.swing.text.AbstractWriter


public static void setSorted(boolean sorted)
Enable or disable the attribute sorting of the writer. Since writers are create internally on demand this option is static for all InetHtmlWriter on the current VM! Note: This will

sorted - true, if the attributes should be sorted


public void setInlineMode(boolean inlineMode)
Sets the writer to inline-CSS mode. In this mode all linked stylesheets and the script tag will be dropped. Instead the effective styles will be written inline into each element. That way the writer generates an monolithic but style-reference free html output.

inlineMode - true to activate the inline mode, false to write a normal html content