< prev index next >

src/java.base/share/classes/java/net/CacheRequest.java

Print this page




  27 
  28 import java.io.OutputStream;
  29 import java.io.IOException;
  30 
  31 /**
  32  * Represents channels for storing resources in the
  33  * ResponseCache. Instances of such a class provide an
  34  * OutputStream object which is called by protocol handlers to
  35  * store the resource data into the cache, and also an abort() method
  36  * which allows a cache store operation to be interrupted and
  37  * abandoned. If an IOException is encountered while reading the
  38  * response or writing to the cache, the current cache store operation
  39  * will be aborted.
  40  *
  41  * @author Yingxian Wang
  42  * @since 1.5
  43  */
  44 public abstract class CacheRequest {
  45 
  46     /**





  47      * Returns an OutputStream to which the response body can be
  48      * written.
  49      *
  50      * @return an OutputStream to which the response body can
  51      *         be written
  52      * @throws IOException if an I/O error occurs while
  53      *         writing the response body
  54      */
  55     public abstract OutputStream getBody() throws IOException;
  56 
  57     /**
  58      * Aborts the attempt to cache the response. If an IOException is
  59      * encountered while reading the response or writing to the cache,
  60      * the current cache store operation will be abandoned.
  61      */
  62     public abstract void abort();
  63 }


  27 
  28 import java.io.OutputStream;
  29 import java.io.IOException;
  30 
  31 /**
  32  * Represents channels for storing resources in the
  33  * ResponseCache. Instances of such a class provide an
  34  * OutputStream object which is called by protocol handlers to
  35  * store the resource data into the cache, and also an abort() method
  36  * which allows a cache store operation to be interrupted and
  37  * abandoned. If an IOException is encountered while reading the
  38  * response or writing to the cache, the current cache store operation
  39  * will be aborted.
  40  *
  41  * @author Yingxian Wang
  42  * @since 1.5
  43  */
  44 public abstract class CacheRequest {
  45 
  46     /**
  47      * Constructor for subclasses to call.
  48      */
  49     public CacheRequest() {}
  50 
  51     /**
  52      * Returns an OutputStream to which the response body can be
  53      * written.
  54      *
  55      * @return an OutputStream to which the response body can
  56      *         be written
  57      * @throws IOException if an I/O error occurs while
  58      *         writing the response body
  59      */
  60     public abstract OutputStream getBody() throws IOException;
  61 
  62     /**
  63      * Aborts the attempt to cache the response. If an IOException is
  64      * encountered while reading the response or writing to the cache,
  65      * the current cache store operation will be abandoned.
  66      */
  67     public abstract void abort();
  68 }
< prev index next >