org.glassfish.jersey.server
Class ChunkedOutput<T>

java.lang.Object
  extended by javax.ws.rs.core.GenericType<T>
      extended by org.glassfish.jersey.server.ChunkedOutput<T>
Type Parameters:
T - chunk type.
All Implemented Interfaces:
Closeable

public class ChunkedOutput<T>
extends GenericType<T>
implements Closeable

Used for sending messages in "typed" chunks. Useful for long running processes, which needs to produce partial responses.

Author:
Pavel Bucek (pavel.bucek at oracle.com), Martin Matula (martin.matula at oracle.com)

Constructor Summary
protected ChunkedOutput()
          Create new chunked response.
  ChunkedOutput(Type chunkType)
          Create ChunkedOutput with specified type.
 
Method Summary
 void close()
          Close this response - it will be finalized and underlying connections will be closed or made available for another response.
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isClosed()
          Get state information.
 String toString()
           
 void write(T chunk)
          Write a chunk.
 
Methods inherited from class javax.ws.rs.core.GenericType
getRawType, getType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChunkedOutput

protected ChunkedOutput()
Create new chunked response.


ChunkedOutput

public ChunkedOutput(Type chunkType)
Create ChunkedOutput with specified type.

Parameters:
chunkType - chunk type
Method Detail

write

public void write(T chunk)
           throws IOException
Write a chunk.

Parameters:
chunk - a chunk instance to be written.
Throws:
IOException - if this response is closed or when encountered any problem during serializing or writing a chunk.

close

public void close()
           throws IOException
Close this response - it will be finalized and underlying connections will be closed or made available for another response.

Specified by:
close in interface Closeable
Throws:
IOException

isClosed

public boolean isClosed()
Get state information. Please note that ChunkedOutput can be closed by the client side - client can close connection from its side.

Returns:
true when closed, false otherwise.

equals

public boolean equals(Object obj)
Overrides:
equals in class GenericType<T>

hashCode

public int hashCode()
Overrides:
hashCode in class GenericType<T>

toString

public String toString()
Overrides:
toString in class GenericType<T>


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.