Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/net/httpserver/UnmodifiableHeaders.java
38918 views
/*1* Copyright (c) 2005, 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 sun.net.httpserver;2627import java.util.*;28import com.sun.net.httpserver.*;2930class UnmodifiableHeaders extends Headers {3132Headers map;3334UnmodifiableHeaders(Headers map) {35this.map = map;36}3738public int size() {return map.size();}3940public boolean isEmpty() {return map.isEmpty();}4142public boolean containsKey(Object key) {43return map.containsKey (key);44}4546public boolean containsValue(Object value) {47return map.containsValue(value);48}4950public List<String> get(Object key) {51return map.get(key);52}5354public String getFirst (String key) {55return map.getFirst(key);56}575859public List<String> put(String key, List<String> value) {60return map.put (key, value);61}6263public void add (String key, String value) {64throw new UnsupportedOperationException ("unsupported operation");65}6667public void set (String key, String value) {68throw new UnsupportedOperationException ("unsupported operation");69}7071public List<String> remove(Object key) {72throw new UnsupportedOperationException ("unsupported operation");73}7475public void putAll(Map<? extends String,? extends List<String>> t) {76throw new UnsupportedOperationException ("unsupported operation");77}7879public void clear() {80throw new UnsupportedOperationException ("unsupported operation");81}8283public Set<String> keySet() {84return Collections.unmodifiableSet (map.keySet());85}8687public Collection<List<String>> values() {88return Collections.unmodifiableCollection(map.values());89}9091/* TODO check that contents of set are not modifable : security */9293public Set<Map.Entry<String, List<String>>> entrySet() {94return Collections.unmodifiableSet (map.entrySet());95}9697public boolean equals(Object o) {return map.equals(o);}9899public int hashCode() {return map.hashCode();}100}101102103