Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.jet
Class BodyContentWriter

java.lang.Object
  extended by 
org.eclipse.jet.BodyContentWriter
All Implemented Interfaces:
BufferedJET2Writer, JET2Writer

public class BodyContentWriter
extends java.lang.Object
implements BufferedJET2Writer

Standard implementation of BufferedJET2Writer that uses on IDocument as its buffer.


Constructor Summary
BodyContentWriter ()
           
 
Method Summary
 void addEventListener (java.lang.String category, IWriterListener listener)
          Add a listener to the writer life cycle events.
 void addPosition (java.lang.String category, org.eclipse.jface.text.Position position)
          Convenience method wrapping getDocument().addPosition(String, Position).
 void addPositionCategory (java.lang.String category)
          Convenience method wrapping getDocument().addPositionCategory(String).
 java.lang.Object getAdapter (java.lang.Class adapterClass)
          Adapt the writer to the given class.
 java.lang.String getContent ()
          Return the buffered content of the writer as a string.
 java.lang.String getContent (int offset, int length)
          Return a ranged of text within the buffered cotnent of the writer.
 int getContentLength ()
          Return the length of the buffered content.
 org.eclipse.jface.text.IDocument getDocument ()
          Return the backing IDocument for this writer.
  IWriterListener[] getEventListeners ()
          Return the registered writer event listeners
 int getLength ()
          Return the current length (in characters) of the output
  JET2Writer getParentWriter ()
          Return the parent of this writer, if it was created via JET2Writer.newNestedContentWriter().
 org.eclipse.jface.text.Position[] getPositions (java.lang.String category)
          Convenience method wrapping getDocument().getPositions(String).
  JET2Writer newNestedContentWriter ()
          Create a writer for handling nested content.
 void replace (int offset, int length, java.lang.String text)
          Convenience method wrapping getDocument().replace(int,int,String).
 void replaceContent (int offset, int length, java.lang.String text)
          Replace content in the buffer.
 void setContent (java.lang.String content)
          Set the buffer content, removing any previously written content.
 java.lang.String toString ()
           
 void write (boolean b)
          Write the passed boolean by calling String.valueOf(boolean).
 void write (char c)
          Write the passed character by calling String.valueOf(char).
 void write (char[] data)
          Write the passed character array by calling String.valueOf(char[]).
 void write (double d)
          Write the passed double value by calling String.valueOf(double).
 void write (float f)
          Write the passed float value by calling String.valueOf(float).
 void write (int i)
          Write the passed integer by calling String.valueOf(int).
 void write ( JET2Writer bodyContent)
          Write the contents of the passed writer to this writer.
 void write (long l)
          Write the passed long value calling String.valueOf(long).
 void write (java.lang.Object obj)
          Write the pass object by calling Object.toString().
 void write (java.lang.String string)
          Write the passed string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BodyContentWriter

public BodyContentWriter()
Method Detail

write

public final void write(java.lang.String string)
Description copied from interface: JET2Writer
Write the passed string.

Specified by:
write in interface JET2Writer
Parameters:
string - a string value.
See Also:
JET2Writer.write(java.lang.String)

write

public final void write(
JET2Writer bodyContent)
Description copied from interface: JET2Writer
Write the contents of the passed writer to this writer.

Specified by:
write in interface JET2Writer
Parameters:
bodyContent - a writer
See Also:
JET2Writer.write(org.eclipse.jet.JET2Writer)

write

public final void write(int i)
Description copied from interface: JET2Writer
Write the passed integer by calling String.valueOf(int).

Specified by:
write in interface JET2Writer
Parameters:
i - an integer value
See Also:
JET2Writer.write(int)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

newNestedContentWriter

public final 
JET2Writer newNestedContentWriter()
Description copied from interface: JET2Writer
Create a writer for handling nested content. The new writer will have access to all position handlers defined on the parent writer (and its parents)

Specified by:
newNestedContentWriter in interface JET2Writer
Returns:
the nested content writer of type BufferedJET2Writer

getLength

public final int getLength()
Description copied from interface: JET2Writer
Return the current length (in characters) of the output

Specified by:
getLength in interface JET2Writer
Returns:
the current length

getDocument

public final org.eclipse.jface.text.IDocument getDocument()
Description copied from interface: JET2Writer
Return the backing IDocument for this writer. Use this method to do advanced writer processing, such as adding Positions for later re-writing of the document contents.

Specified by:
getDocument in interface JET2Writer
Returns:
the backing document

addEventListener

public final void addEventListener(java.lang.String category,
                                   
IWriterListener listener)
Description copied from interface: JET2Writer
Add a listener to the writer life cycle events. The writer records one listener per category. Subsequent calls to this method with the same category value have no effect. If the listener was created view JET2Writer.newNestedContentWriter(), then the listener is added to the root writer, rather than the listener itself.

Specified by:
addEventListener in interface JET2Writer
Parameters:
category - the listener category
listener - a listener

addPositionCategory

public final void addPositionCategory(java.lang.String category)
Description copied from interface: JET2Writer
Convenience method wrapping getDocument().addPositionCategory(String).

Specified by:
addPositionCategory in interface JET2Writer
Parameters:
category - a Position Category
See Also:
IDocument.addPositionCategory(java.lang.String)

addPosition

public final void addPosition(java.lang.String category,
                              org.eclipse.jface.text.Position position)
Description copied from interface: JET2Writer
Convenience method wrapping getDocument().addPosition(String, Position). Any BadPositionCategoryException or BadLocationException is wrapped in a a runtime exception.

Specified by:
addPosition in interface JET2Writer
Parameters:
category - a position category
position - a position
See Also:
IDocument.addPosition(java.lang.String, org.eclipse.jface.text.Position)

getPositions

public final org.eclipse.jface.text.Position[] getPositions(java.lang.String category)
Description copied from interface: JET2Writer
Convenience method wrapping getDocument().getPositions(String). Any BadPositionCategoryException is wrapped in a runtime exception.

Specified by:
getPositions in interface JET2Writer
Parameters:
category - a position category
Returns:
an array of positions
See Also:
IDocument.getPositions(java.lang.String)

replace

public final void replace(int offset,
                          int length,
                          java.lang.String text)
Description copied from interface: JET2Writer
Convenience method wrapping getDocument().replace(int,int,String). Any BadLocationException is wrapped in a runtime exception.

Specified by:
replace in interface JET2Writer
Parameters:
offset - the offset of the text to replace
length - the length of the text to replace
text - the replacement text
See Also:
IDocument.replace(int, int, java.lang.String)

getParentWriter

public final 
JET2Writer getParentWriter()
Description copied from interface: JET2Writer
Return the parent of this writer, if it was created via JET2Writer.newNestedContentWriter().

Specified by:
getParentWriter in interface JET2Writer
Returns:
the parent writer, or null.

write

public final void write(boolean b)
Description copied from interface: JET2Writer
Write the passed boolean by calling String.valueOf(boolean).

Specified by:
write in interface JET2Writer
Parameters:
b - a boolean value

write

public final void write(char c)
Description copied from interface: JET2Writer
Write the passed character by calling String.valueOf(char).

Specified by:
write in interface JET2Writer
Parameters:
c - a char value

write

public final void write(char[] data)
Description copied from interface: JET2Writer
Write the passed character array by calling String.valueOf(char[]).

Specified by:
write in interface JET2Writer
Parameters:
data - an array of characters

write

public final void write(double d)
Description copied from interface: JET2Writer
Write the passed double value by calling String.valueOf(double).

Specified by:
write in interface JET2Writer
Parameters:
d - a double value

write

public final void write(float f)
Description copied from interface: JET2Writer
Write the passed float value by calling String.valueOf(float).

Specified by:
write in interface JET2Writer
Parameters:
f - a float value

write

public final void write(long l)
Description copied from interface: JET2Writer
Write the passed long value calling String.valueOf(long).

Specified by:
write in interface JET2Writer
Parameters:
l - a long value.

write

public final void write(java.lang.Object obj)
Description copied from interface: JET2Writer
Write the pass object by calling Object.toString().

Specified by:
write in interface JET2Writer
Parameters:
obj - an object.

getContent

public java.lang.String getContent()
Description copied from interface: BufferedJET2Writer
Return the buffered content of the writer as a string.

Specified by:
getContent in interface BufferedJET2Writer
Returns:
the content

getContentLength

public int getContentLength()
Description copied from interface: BufferedJET2Writer
Return the length of the buffered content.

Specified by:
getContentLength in interface BufferedJET2Writer
Returns:
the length

getEventListeners

public 
IWriterListener[] getEventListeners()
Description copied from interface: JET2Writer
Return the registered writer event listeners

Specified by:
getEventListeners in interface JET2Writer
Returns:
a possibly empty array of listeners

replaceContent

public void replaceContent(int offset,
                           int length,
                           java.lang.String text)
Description copied from interface: BufferedJET2Writer
Replace content in the buffer.

Specified by:
replaceContent in interface BufferedJET2Writer
Parameters:
offset - the offset of the text to replace
length - the length of the text to replace
text - the replacement text

setContent

public void setContent(java.lang.String content)
Description copied from interface: BufferedJET2Writer
Set the buffer content, removing any previously written content.

Specified by:
setContent in interface BufferedJET2Writer

getContent

public java.lang.String getContent(int offset,
                                   int length)
Description copied from interface: BufferedJET2Writer
Return a ranged of text within the buffered cotnent of the writer.

Specified by:
getContent in interface BufferedJET2Writer
Parameters:
offset - the offset of the text to return
length - the length of the text to return
Returns:
the content

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapterClass)
Description copied from interface: BufferedJET2Writer
Adapt the writer to the given class. The primary use of this method is to access the underlying buffer implementation.

Specified by:
getAdapter in interface BufferedJET2Writer
Parameters:
adapterClass - the class to return
Returns:
the adapter or null if adapterClass is not supported.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire