1. /*
  2. * @(#)CacheResponse.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.InputStream;
  9. import java.util.Map;
  10. import java.util.List;
  11. import java.io.IOException;
  12. /**
  13. * Represent channels for retrieving resources from the
  14. * ResponseCache. Instances of such a class provide an
  15. * InputStream that returns the entity body, and also a
  16. * getHeaders() method which returns the associated response headers.
  17. *
  18. * @version 1.1, 03/09/22
  19. * @author Yingxian Wang
  20. * @since 1.5
  21. */
  22. public abstract class CacheResponse {
  23. /**
  24. * Returns the response headers as a Map.
  25. *
  26. * @return An immutable Map from response header field names to
  27. * lists of field values. The status line has null as its
  28. * field name.
  29. * @throws IOException if an I/O error occurs
  30. * while getting the response headers
  31. */
  32. public abstract Map<String, List<String>> getHeaders() throws IOException;
  33. /**
  34. * Returns the response body as an InputStream.
  35. *
  36. * @return an InputStream from which the response body can
  37. * be accessed
  38. * @throws IOException if an I/O error occurs while
  39. * getting the response body
  40. */
  41. public abstract InputStream getBody() throws IOException;
  42. }