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. package java.net;
  8. import java.io.OutputStream;
  9. import java.io.IOException;
  10. /**
  11. * Represents channels for storing resources in the
  12. * ResponseCache. Instances of such a class provide an
  13. * OutputStream object which is called by protocol handlers to
  14. * store the resource data into the cache, and also an abort() method
  15. * which allows a cache store operation to be interrupted and
  16. * abandoned. If an IOException is encountered while reading the
  17. * response or writing to the cache, the current cache store operation
  18. * will be aborted.
  19. *
  20. * @version 1.1, 03/09/22
  21. * @author Yingxian Wang
  22. * @since 1.5
  23. */
  24. public abstract class CacheRequest {
  25. /**
  26. * Returns an OutputStream to which the response body can be
  27. * written.
  28. *
  29. * @return an OutputStream to which the response body can
  30. * be written
  31. * @throws IOException if an I/O error occurs while
  32. * writing the response body
  33. */
  34. public abstract OutputStream getBody() throws IOException;
  35. /**
  36. * Aborts the attempt to cache the response. If an IOException is
  37. * encountered while reading the response or writing to the cache,
  38. * the current cache store operation will be abandoned.
  39. */
  40. public abstract void abort();
  41. }