org.openrdf.sesame.server.http
Class HTTPOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.openrdf.sesame.server.http.HTTPOutputStream

public class HTTPOutputStream
extends OutputStream

An OutputStream that wraps an HttpServletResponse. HTTPOutputStream is implemented such that it only set the status and opens an output stream to a supplied HttpServletResponse when the first byte is actually written.


Constructor Summary
HTTPOutputStream(HttpServletResponse response)
          Creates a new HTTPOutputStream.
HTTPOutputStream(HttpServletResponse response, String contentType)
          Creates a new HTTPOutputStream.
 
Method Summary
 void close()
           
 void flush()
           
 void setCacheableResult(boolean cacheable)
          Sets whether the receiver of the written result is allowed cache it.
 void setContentType(String contentType)
          Sets the content type that will be reported to the client, e.g.
 void setUseGZIPCompression(boolean useGZIP)
          Sets whether written response should be compressed using gzip.
 boolean streamClosed()
          Checks whether the response stream has been closed.
 boolean streamOpened()
          Checks whether the response stream has been opened yet.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPOutputStream

public HTTPOutputStream(HttpServletResponse response)
Creates a new HTTPOutputStream.


HTTPOutputStream

public HTTPOutputStream(HttpServletResponse response,
                        String contentType)
Creates a new HTTPOutputStream.

Method Detail

setContentType

public void setContentType(String contentType)
Sets the content type that will be reported to the client, e.g. text/html.


setCacheableResult

public void setCacheableResult(boolean cacheable)
Sets whether the receiver of the written result is allowed cache it. Setting this flag to false will result in a number of headers being added to the HTTP response.


setUseGZIPCompression

public void setUseGZIPCompression(boolean useGZIP)
Sets whether written response should be compressed using gzip. This should only be enable if the sender of the request has indicated that it can handle gzip-encoded data.


write

public void write(int b)
           throws IOException
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

flush

public void flush()
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

streamOpened

public boolean streamOpened()
Checks whether the response stream has been opened yet. Note that this method does not indicate that the stream is still open, it might has been closed again.

Returns:
true if the stream has been opened, false otherwise.

streamClosed

public boolean streamClosed()
Checks whether the response stream has been closed.

Returns:
true if the stream has been closed, false otherwise.


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.