com.hp.hpl.jena.sparql.resultset
Class TextOutput

java.lang.Object
  extended by com.hp.hpl.jena.sparql.resultset.OutputBase
      extended by com.hp.hpl.jena.sparql.resultset.TextOutput
All Implemented Interfaces:
OutputFormatter

public class TextOutput
extends OutputBase

Takes a ResultSet object and creates displayable formatted output in plain text.

Note: this is compute intensive and memory intensive. It needs to read all the results first (all the results are then in-memory) in order to find things the maximum width of a column value; then it needs to pass over the results again, turning them into output.

See Also:
for convenience ways to call this formatter

Constructor Summary
TextOutput(com.hp.hpl.jena.shared.PrefixMapping pMap)
           
TextOutput(Prologue prologue)
           
TextOutput(SerializationContext cxt)
           
 
Method Summary
 void format(OutputStream out, boolean answer)
          Format a boolean result - output on the given stream
 void format(OutputStream outs, ResultSet resultSet)
          Format a result set - output on the given stream
 void format(Writer w, ResultSet resultSet)
          Writer should be UTF-8 encoded - better to an OutputStream
 void write(OutputStream outs, ResultSet resultSet)
          Output a result set.
 void write(OutputStream outs, ResultSet resultSet, String colStart, String colSep, String colEnd)
          Output a result set.
 void write(PrintWriter pw, ResultSet resultSet)
          Textual representation : default layout using " | " to separate columns.
 void write(PrintWriter pw, ResultSet resultSet, String colStart, String colSep, String colEnd)
          Textual representation : layout using given separator.
 
Methods inherited from class com.hp.hpl.jena.sparql.resultset.OutputBase
asString, asString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextOutput

public TextOutput(Prologue prologue)

TextOutput

public TextOutput(com.hp.hpl.jena.shared.PrefixMapping pMap)

TextOutput

public TextOutput(SerializationContext cxt)
Method Detail

format

public void format(OutputStream outs,
                   ResultSet resultSet)
Description copied from interface: OutputFormatter
Format a result set - output on the given stream


format

public void format(Writer w,
                   ResultSet resultSet)
Writer should be UTF-8 encoded - better to an OutputStream


write

public void write(PrintWriter pw,
                  ResultSet resultSet)
Textual representation : default layout using " | " to separate columns. Ensure the PrintWriter can handle UTF-8. OutputStream version is preferred.

Parameters:
pw - A PrintWriter
resultSet - ResultSet

write

public void write(OutputStream outs,
                  ResultSet resultSet)
Output a result set.

Parameters:
outs - OutputStream
resultSet - ResultSet

write

public void write(OutputStream outs,
                  ResultSet resultSet,
                  String colStart,
                  String colSep,
                  String colEnd)
Output a result set.

Parameters:
outs - OutputStream
resultSet - ResultSet
colStart - Left column
colSep - Inter-column
colEnd - Right column

write

public void write(PrintWriter pw,
                  ResultSet resultSet,
                  String colStart,
                  String colSep,
                  String colEnd)
Textual representation : layout using given separator. Ensure the PrintWriter can handle UTF-8.

Parameters:
pw - PrintWriter
colSep - Column separator

format

public void format(OutputStream out,
                   boolean answer)
Description copied from interface: OutputFormatter
Format a boolean result - output on the given stream



Licenced under the Apache License, Version 2.0