Path: blob/master/src/java.base/share/classes/java/net/CacheResponse.java
41152 views
/*1* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.net;2627import java.io.InputStream;28import java.util.Map;29import java.util.List;30import java.io.IOException;3132/**33* Represent channels for retrieving resources from the34* ResponseCache. Instances of such a class provide an35* InputStream that returns the entity body, and also a36* getHeaders() method which returns the associated response headers.37*38* @author Yingxian Wang39* @since 1.540*/41public abstract class CacheResponse {4243/**44* Constructor for subclasses to call.45*/46public CacheResponse() {}4748/**49* Returns the response headers as a Map.50*51* @return An immutable Map from response header field names to52* lists of field values. The status line has null as its53* field name.54* @throws IOException if an I/O error occurs55* while getting the response headers56*/57public abstract Map<String, List<String>> getHeaders() throws IOException;5859/**60* Returns the response body as an InputStream.61*62* @return an InputStream from which the response body can63* be accessed64* @throws IOException if an I/O error occurs while65* getting the response body66*/67public abstract InputStream getBody() throws IOException;68}697071