public class DXLBufferFragment extends Object implements DXLFragment
A buffer should be used when computing dynamic information. All static DXL code parts (like function declarations) should be loaded with a
DXLFileFragment
instead.
Here is a snippet (see DXLEngine for a full snippet):
DXLBufferFragment buffer = DXLBufferFragment.create(); buffer.appendLine("// a DXL script to execute"); buffer.appendLine("int i = 9;"); buffer.append("string s = ").quote("myValue").appendLine(";"); DXLEngine engine = ...; engine.execute(new DXLFRagment[] { buffer });
DXLEngine
,
DXLFileFragment
Modifier | Constructor and Description |
---|---|
protected |
DXLBufferFragment(boolean useIndent) |
Modifier and Type | Method and Description |
---|---|
DXLBufferFragment |
append(boolean b) |
DXLBufferFragment |
append(char c) |
DXLBufferFragment |
append(int i) |
DXLBufferFragment |
append(long i) |
DXLBufferFragment |
append(Object object) |
DXLBufferFragment |
append(String text) |
DXLBufferFragment |
appendLine() |
DXLBufferFragment |
appendLine(char c) |
DXLBufferFragment |
appendLine(String line) |
static DXLBufferFragment |
create() |
DXLBufferFragment |
endBlock() |
DXLBufferFragment |
escape(String text) |
protected static String |
escapeString(String s,
boolean quoted) |
DXLBufferFragment |
escapeUnquoted(String text) |
protected StringBuffer |
getBuffer() |
protected void |
indent() |
protected void |
newLine() |
DXLBufferFragment |
quote(String text) |
DXLBufferFragment |
startBlock(String text) |
String |
toString() |
void |
write(Writer writer)
Writes the content of this fragment into the specified writer.
|
public static DXLBufferFragment create()
protected final StringBuffer getBuffer()
protected final void indent()
protected final void newLine()
public DXLBufferFragment append(Object object)
public DXLBufferFragment append(String text)
public DXLBufferFragment append(char c)
public DXLBufferFragment append(int i)
public DXLBufferFragment append(long i)
public DXLBufferFragment append(boolean b)
public DXLBufferFragment quote(String text)
public DXLBufferFragment escape(String text)
public DXLBufferFragment escapeUnquoted(String text)
public DXLBufferFragment appendLine()
public DXLBufferFragment appendLine(String line)
public DXLBufferFragment appendLine(char c)
public DXLBufferFragment startBlock(String text)
public DXLBufferFragment endBlock()
public void write(Writer writer) throws IOException
DXLFragment
DXLEngine
when combining
fragments into a DXL file.write
in interface DXLFragment
writer
- the writer in which to output the content of the fragment.IOException
- if the content cannot be written.