Class StreamedOutput
- java.lang.Object
-
- org.intermine.webservice.server.output.Output
-
- org.intermine.webservice.server.output.StreamedOutput
-
public class StreamedOutput extends Output
Immediately as the data or error messages are added they are streamed via http connection. So the data can not be retrieved later. Before streaming they are formatted with associated formatter.- Author:
- Jakub Kulaviak, Alex Kalderimis
-
-
Field Summary
-
Fields inherited from class org.intermine.webservice.server.output.Output
NOT_ACCEPTABLE, SC_BAD_REQUEST, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_NO_CONTENT, SC_NOT_FOUND, SC_OK, SC_UNAUTHORIZED
-
-
Constructor Summary
Constructors Constructor Description StreamedOutput(java.io.PrintWriter writer, Formatter formatter)
Constructor.StreamedOutput(java.io.PrintWriter writer, Formatter formatter, java.lang.String separator)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResultItem(java.util.List<java.lang.String> item)
Forwards data to associated writervoid
flush()
Finish writing.int
getResultsCount()
java.io.PrintWriter
getWriter()
Returns associated writervoid
setHeaderAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets header attributes that are displayed for example in xml header.void
setWriter(java.io.PrintWriter writer)
Sets associated writervoid
writeFooter()
Writes footervoid
writeLn(java.lang.String s)
-
Methods inherited from class org.intermine.webservice.server.output.Output
getCode, getError, getHeaderAttributes, setError
-
-
-
-
Constructor Detail
-
StreamedOutput
public StreamedOutput(java.io.PrintWriter writer, Formatter formatter)
Constructor.- Parameters:
writer
- writer where the data will be printedformatter
- associated formatter that formats data before printing
-
StreamedOutput
public StreamedOutput(java.io.PrintWriter writer, Formatter formatter, java.lang.String separator)
Constructor.- Parameters:
writer
- writer where the data will be printedformatter
- associated formatter that formats data before printingseparator
- Platform specific line-separator for the request.
-
-
Method Detail
-
writeLn
public void writeLn(java.lang.String s)
- Parameters:
s
- string to write
-
addResultItem
public void addResultItem(java.util.List<java.lang.String> item)
Forwards data to associated writer- Specified by:
addResultItem
in classOutput
- Parameters:
item
- data
-
getWriter
public java.io.PrintWriter getWriter()
Returns associated writer- Returns:
- writer
-
setWriter
public void setWriter(java.io.PrintWriter writer)
Sets associated writer- Parameters:
writer
- writer
-
writeFooter
public void writeFooter()
Writes footer
-
setHeaderAttributes
public void setHeaderAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets header attributes that are displayed for example in xml header.- Overrides:
setHeaderAttributes
in classOutput
- Parameters:
attributes
- header attributes
-
getResultsCount
public int getResultsCount()
- Specified by:
getResultsCount
in classOutput
- Returns:
- number of written results
-
-