1 /* 2 * @(#)CacheRequest.java 1.1 03/09/22 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.net; 9 10 import java.io.OutputStream; 11 import java.io.IOException; 12 13 /** 14 * Represents channels for storing resources in the 15 * ResponseCache. Instances of such a class provide an 16 * OutputStream object which is called by protocol handlers to 17 * store the resource data into the cache, and also an abort() method 18 * which allows a cache store operation to be interrupted and 19 * abandoned. If an IOException is encountered while reading the 20 * response or writing to the cache, the current cache store operation 21 * will be aborted. 22 * 23 * @version 1.1, 03/09/22 24 * @author Yingxian Wang 25 * @since 1.5 26 */ 27 public abstract class CacheRequest { 28 29 /** 30 * Returns an OutputStream to which the response body can be 31 * written. 32 * 33 * @return an OutputStream to which the response body can 34 * be written 35 * @throws IOException if an I/O error occurs while 36 * writing the response body 37 */ 38 public abstract OutputStream getBody() throws IOException; 39 40 /** 41 * Aborts the attempt to cache the response. If an IOException is 42 * encountered while reading the response or writing to the cache, 43 * the current cache store operation will be abandoned. 44 */ 45 public abstract void abort(); 46 } 47