annotate src/org/eclipse/jetty/io/Buffer.java @ 1018:4dc1e1a18661

remove HttpSchemes
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 24 Oct 2016 05:37:24 -0600
parents 2712133d5bce
children 6647dbc8be71
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 package org.eclipse.jetty.io;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 import java.io.InputStream;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import java.io.OutputStream;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import java.nio.charset.Charset;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 /**
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 * Byte Buffer interface.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 * This is a byte buffer that is designed to work like a FIFO for bytes. Puts and Gets operate on different
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 * pointers into the buffer and the valid _content of the buffer is always between the getIndex and the putIndex.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 * This buffer interface is designed to be similar, but not dependent on the java.nio buffers, which may
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 * be used to back an implementation of this Buffer. The main difference is that NIO buffer after a put have
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 * their valid _content before the position and a flip is required to access that data.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 * For this buffer it is always true that:
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 * markValue <= getIndex <= putIndex <= capacity
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 * @version 1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 public interface Buffer extends Cloneable
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 {
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
45 public final static int
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
46 IMMUTABLE=0, // neither indexes or contexts can be changed
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
47 READONLY=1, // indexes may be changed, but not content
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
48 READWRITE=2; // anything can be changed
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
49 public final boolean VOLATILE=true; // The buffer may change outside of current scope.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
50 public final boolean NON_VOLATILE=false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
52 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
53 * Get the underlying array, if one exists.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
54 * @return a <code>byte[]</code> backing this buffer or null if none exists.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
55 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
56 byte[] array();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
57
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
58 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
59 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
60 * @return a <code>byte[]</code> value of the bytes from the getIndex to the putIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
61 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
62 byte[] asArray();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
63
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
64 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
65 * Get the underlying buffer. If this buffer wraps a backing buffer.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
66 * @return The root backing buffer or this if there is no backing buffer;
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
67 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
68 Buffer buffer();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
69
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
70 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
71 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
72 * @return a readonly version of this <code>Buffer</code>.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
73 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
74 Buffer asReadOnlyBuffer();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
75
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
76 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
77 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
78 * @return an immutable version of this <code>Buffer</code>.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
79 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
80 Buffer asImmutableBuffer();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
81
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
82 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
83 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
84 * The capacity of the buffer. This is the maximum putIndex that may be set.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
85 * @return an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
86 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
87 int capacity();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
88
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
89 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
90 * the space remaining in the buffer.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
91 * @return capacity - putIndex
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
92 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
93 int space();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
94
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
95 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
96 * Clear the buffer. getIndex=0, putIndex=0.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
97 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
98 void clear();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
99
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
100 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
101 * Compact the buffer by discarding bytes before the postion (or mark if set).
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
102 * Bytes from the getIndex (or mark) to the putIndex are moved to the beginning of
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
103 * the buffer and the values adjusted accordingly.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
104 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
105 void compact();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
106
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
107 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
108 * Get the byte at the current getIndex and increment it.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
109 * @return The <code>byte</code> value from the current getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
110 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
111 byte get();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
112
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
113 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
114 * Get bytes from the current postion and put them into the passed byte array.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
115 * The getIndex is incremented by the number of bytes copied into the array.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
116 * @param b The byte array to fill.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
117 * @param offset Offset in the array.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
118 * @param length The max number of bytes to read.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
119 * @return The number of bytes actually read.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
120 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
121 int get(byte[] b, int offset, int length);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
122
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
123 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
124 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
125 * @param length an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
126 * @return a <code>Buffer</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
127 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
128 Buffer get(int length);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
129
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
130 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
131 * The index within the buffer that will next be read or written.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
132 * @return an <code>int</code> value >=0 <= putIndex()
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
133 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
134 int getIndex();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
135
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
136 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
137 * @return true of putIndex > getIndex
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
138 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
139 boolean hasContent();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
140
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
141 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
142 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
143 * @return a <code>boolean</code> value true if case sensitive comparison on this buffer
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
144 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
145 boolean equalsIgnoreCase(Buffer buffer);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
146
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
147
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
148 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
149 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
150 * @return a <code>boolean</code> value true if the buffer is immutable and that neither
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
151 * the buffer contents nor the indexes may be changed.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
152 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
153 boolean isImmutable();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
154
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
155 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
156 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
157 * @return a <code>boolean</code> value true if the buffer is readonly. The buffer indexes may
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
158 * be modified, but the buffer contents may not. For example a View onto an immutable Buffer will be
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
159 * read only.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
160 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
161 boolean isReadOnly();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
162
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
163 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
164 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
165 * @return a <code>boolean</code> value true if the buffer contents may change
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
166 * via alternate paths than this buffer. If the contents of this buffer are to be used outside of the
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
167 * current context, then a copy must be made.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
168 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
169 boolean isVolatile();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
170
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
171 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
172 * The number of bytes from the getIndex to the putIndex
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
173 * @return an <code>int</code> == putIndex()-getIndex()
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
174 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
175 int length();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
176
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
177 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
178 * Set the mark to the current getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
179 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
180 void mark();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
181
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
182 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
183 * Set the mark relative to the current getIndex
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
184 * @param offset an <code>int</code> value to add to the current getIndex to obtain the mark value.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
185 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
186 void mark(int offset);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
187
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
188 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
189 * The current index of the mark.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
190 * @return an <code>int</code> index in the buffer or -1 if the mark is not set.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
191 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
192 int markIndex();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
193
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
194 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
195 * Get the byte at the current getIndex without incrementing the getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
196 * @return The <code>byte</code> value from the current getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
197 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
198 byte peek();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
199
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
200 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
201 * Get the byte at a specific index in the buffer.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
202 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
203 * @return a <code>byte</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
204 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
205 byte peek(int index);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
206
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
207 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
208 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
209 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
210 * @param length an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
211 * @return The <code>Buffer</code> value from the requested getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
212 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
213 Buffer peek(int index, int length);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
214
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
215 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
216 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
217 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
218 * @param b The byte array to peek into
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
219 * @param offset The offset into the array to start peeking
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
220 * @param length an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
221 * @return The number of bytes actually peeked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
222 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
223 int peek(int index, byte[] b, int offset, int length);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
224
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
225 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
226 * Put the contents of the buffer at the specific index.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
227 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
228 * @param src a <code>Buffer</code>. If the source buffer is not modified
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
229
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
230 * @return The number of bytes actually poked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
231 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
232 int poke(int index, Buffer src);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
233
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
234 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
235 * Put a specific byte to a specific getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
236 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
237 * @param b a <code>byte</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
238 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
239 void poke(int index, byte b);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
240
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
241 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
242 * Put a specific byte to a specific getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
243 * @param index an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
244 * @param b a <code>byte array</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
245 * @return The number of bytes actually poked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
246 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
247 int poke(int index, byte b[], int offset, int length);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
248
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
249 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
250 * Write the bytes from the source buffer to the current getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
251 * @param src The source <code>Buffer</code> it is not modified.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
252 * @return The number of bytes actually poked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
253 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
254 int put(Buffer src);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
255
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
256 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
257 * Put a byte to the current getIndex and increment the getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
258 * @param b a <code>byte</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
259 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
260 void put(byte b);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
261
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
262 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
263 * Put a byte to the current getIndex and increment the getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
264 * @param b a <code>byte</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
265 * @return The number of bytes actually poked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
266 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
267 int put(byte[] b,int offset, int length);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
268
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
269 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
270 * Put a byte to the current getIndex and increment the getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
271 * @param b a <code>byte</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
272 * @return The number of bytes actually poked
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
273 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
274 int put(byte[] b);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
275
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
276 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
277 * The index of the first element that should not be read.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
278 * @return an <code>int</code> value >= getIndex()
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
279 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
280 int putIndex();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
281
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
282 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
283 * Reset the current getIndex to the mark
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
284 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
285 void reset();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
286
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
287 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
288 * Set the buffers start getIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
289 * @param newStart an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
290 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
291 void setGetIndex(int newStart);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
292
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
293 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
294 * Set a specific value for the mark.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
295 * @param newMark an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
296 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
297 void setMarkIndex(int newMark);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
298
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
299 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
300 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
301 * @param newLimit an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
302 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
303 void setPutIndex(int newLimit);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
304
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
305 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
306 * Skip _content. The getIndex is updated by min(remaining(), n)
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
307 * @param n The number of bytes to skip
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
308 * @return the number of bytes skipped.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
309 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
310 int skip(int n);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
311
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
312 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
313 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
314 * @return a volitile <code>Buffer</code> from the postion to the putIndex.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
315 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
316 Buffer slice();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
317
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
318 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
319 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
320 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
321 * @return a volitile <code>Buffer</code> value from the mark to the putIndex
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
322 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
323 Buffer sliceFromMark();
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
324
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
325 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
326 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
327 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
328 * @param length an <code>int</code> value
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
329 * @return a valitile <code>Buffer</code> value from the mark of the length requested.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
330 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
331 Buffer sliceFromMark(int length);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
332
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
333 /**
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
334 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
335 * @return a <code>String</code> value describing the state and contents of the buffer.
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
336 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
337 String toDetailString();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
338
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
339 /* ------------------------------------------------------------ */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
340 /** Read the buffer's contents from the input stream
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
341 * @param in input stream
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
342 * @param max maximum number of bytes that may be read
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
343 * @return actual number of bytes read or -1 for EOF
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
344 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
345 int readFrom(InputStream in, int max) throws IOException;
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
346
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
347
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
348 /* ------------------------------------------------------------ */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
349 String toString(String charset);
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
350
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
351 /* ------------------------------------------------------------ */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
352 String toString(Charset charset);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
353
1010
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
354 /*
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
355 * Buffers implementing this interface should be compared with case insensitive equals
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
356 *
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
357 */
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
358 public interface CaseInsensitve
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
359 {}
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
360
2712133d5bce simplify Buffer code
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
361
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
362 }