comparison src/org/eclipse/jetty/io/JBuffer.java @ 1066:bbbda7c6e8ec

fix use of HttpGenerator._header
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 09 Nov 2016 05:48:10 -0700
parents 158d1e6ac17f
children b4ba8a4d5a16
comparison
equal deleted inserted replaced
1065:158d1e6ac17f 1066:bbbda7c6e8ec
79 79
80 public ByteBuffer getByteBuffer() { 80 public ByteBuffer getByteBuffer() {
81 return bb; 81 return bb;
82 } 82 }
83 83
84 public void clear() {
85 bb.clear();
86 }
87
84 public void clearJ() { 88 public void clearJ() {
85 bb.position(0); 89 bb.position(0);
86 bb.limit(0); 90 bb.limit(0);
87 } 91 }
88 92
94 public void get(byte[] b, int offset, int length) { 98 public void get(byte[] b, int offset, int length) {
95 bb.get(b,offset,length); 99 bb.get(b,offset,length);
96 } 100 }
97 101
98 102
103 public void putQ(JBuffer src) {
104 bb.put(src.bb);
105 }
106
99 public int put(JBuffer src) { 107 public int put(JBuffer src) {
100 return put(src.asArray()); 108 return put(src.asArray());
109 }
110
111 public void putQ(byte b) {
112 bb.put(b);
101 } 113 }
102 114
103 public void put(byte b) 115 public void put(byte b)
104 { 116 {
105 ByteBuffer dup = bb.duplicate(); 117 ByteBuffer dup = bb.duplicate();
120 dup.put(b,offset,length); 132 dup.put(b,offset,length);
121 bb.limit(put+length); 133 bb.limit(put+length);
122 return length; 134 return length;
123 } 135 }
124 136
137 public void putQ(byte[] b) {
138 bb.put(b);
139 }
140
125 public int put(byte[] b) { 141 public int put(byte[] b) {
126 return put(b,0,b.length); 142 return put(b,0,b.length);
127 }
128
129 public final int putIndex() {
130 return bb.limit();
131 }
132
133 public void setPutIndex(int putIndex) {
134 bb.limit(putIndex);
135 } 143 }
136 144
137 public void skip(int n) { 145 public void skip(int n) {
138 if (remaining() < n) n = remaining(); 146 if (remaining() < n) n = remaining();
139 bb.position(bb.position() + n); 147 bb.position(bb.position() + n);
155 163
156 public byte get(int index) { 164 public byte get(int index) {
157 return bb.get(index); 165 return bb.get(index);
158 } 166 }
159 167
168 public void flip() {
169 bb.flip();
170 }
171
160 } 172 }