View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package io.netty.handler.codec;
18  
19  /**
20   * A typical {@code AsciiString} multimap used by protocols that use binary headers (such as HTTP/2) for the
21   * representation of arbitrary key-value data. {@link AsciiString} is just a wrapper around a byte array but provides
22   * some additional utility when handling text data.
23   */
24  public interface BinaryHeaders extends Headers<AsciiString> {
25      /**
26       * A visitor that helps reduce GC pressure while iterating over a collection of {@link Headers}.
27       */
28      interface EntryVisitor extends Headers.EntryVisitor<AsciiString> {
29      }
30  
31      /**
32       * A visitor that helps reduce GC pressure while iterating over a collection of {@link Headers}.
33       */
34      interface NameVisitor extends Headers.NameVisitor<AsciiString> {
35      }
36  
37      @Override
38      BinaryHeaders add(AsciiString name, AsciiString value);
39  
40      @Override
41      BinaryHeaders add(AsciiString name, Iterable<? extends AsciiString> values);
42  
43      @Override
44      BinaryHeaders add(AsciiString name, AsciiString... values);
45  
46      @Override
47      BinaryHeaders addObject(AsciiString name, Object value);
48  
49      @Override
50      BinaryHeaders addObject(AsciiString name, Iterable<?> values);
51  
52      @Override
53      BinaryHeaders addObject(AsciiString name, Object... values);
54  
55      @Override
56      BinaryHeaders addBoolean(AsciiString name, boolean value);
57  
58      @Override
59      BinaryHeaders addByte(AsciiString name, byte value);
60  
61      @Override
62      BinaryHeaders addChar(AsciiString name, char value);
63  
64      @Override
65      BinaryHeaders addShort(AsciiString name, short value);
66  
67      @Override
68      BinaryHeaders addInt(AsciiString name, int value);
69  
70      @Override
71      BinaryHeaders addLong(AsciiString name, long value);
72  
73      @Override
74      BinaryHeaders addFloat(AsciiString name, float value);
75  
76      @Override
77      BinaryHeaders addDouble(AsciiString name, double value);
78  
79      @Override
80      BinaryHeaders addTimeMillis(AsciiString name, long value);
81  
82      /**
83       * See {@link Headers#add(Headers)}
84       */
85      BinaryHeaders add(BinaryHeaders headers);
86  
87      @Override
88      BinaryHeaders set(AsciiString name, AsciiString value);
89  
90      @Override
91      BinaryHeaders set(AsciiString name, Iterable<? extends AsciiString> values);
92  
93      @Override
94      BinaryHeaders set(AsciiString name, AsciiString... values);
95  
96      @Override
97      BinaryHeaders setObject(AsciiString name, Object value);
98  
99      @Override
100     BinaryHeaders setObject(AsciiString name, Iterable<?> values);
101 
102     @Override
103     BinaryHeaders setObject(AsciiString name, Object... values);
104 
105     @Override
106     BinaryHeaders setBoolean(AsciiString name, boolean value);
107 
108     @Override
109     BinaryHeaders setByte(AsciiString name, byte value);
110 
111     @Override
112     BinaryHeaders setChar(AsciiString name, char value);
113 
114     @Override
115     BinaryHeaders setShort(AsciiString name, short value);
116 
117     @Override
118     BinaryHeaders setInt(AsciiString name, int value);
119 
120     @Override
121     BinaryHeaders setLong(AsciiString name, long value);
122 
123     @Override
124     BinaryHeaders setFloat(AsciiString name, float value);
125 
126     @Override
127     BinaryHeaders setDouble(AsciiString name, double value);
128 
129     @Override
130     BinaryHeaders setTimeMillis(AsciiString name, long value);
131 
132     /**
133      * See {@link Headers#set(Headers)}
134      */
135     BinaryHeaders set(BinaryHeaders headers);
136 
137     /**
138      * See {@link Headers#setAll(Headers)}
139      */
140     BinaryHeaders setAll(BinaryHeaders headers);
141 
142     @Override
143     BinaryHeaders clear();
144 }