Mercurial Hosting > luan
comparison src/org/eclipse/jetty/http/HttpGenerator.java @ 1064:a0abb16cf6e7
remove JBuffer.readFrom()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 09 Nov 2016 03:09:37 -0700 |
parents | 013939bfc9e8 |
children | 158d1e6ac17f |
comparison
equal
deleted
inserted
replaced
1063:0157e92670f5 | 1064:a0abb16cf6e7 |
---|---|
198 /** Prepare buffer for unchecked writes. | 198 /** Prepare buffer for unchecked writes. |
199 * Prepare the generator buffer to receive unchecked writes | 199 * Prepare the generator buffer to receive unchecked writes |
200 * @return the available space in the buffer. | 200 * @return the available space in the buffer. |
201 * @throws IOException | 201 * @throws IOException |
202 */ | 202 */ |
203 public int prepareUncheckedAddContent() throws IOException | 203 public void prepareUncheckedAddContent() throws IOException |
204 { | 204 { |
205 if (_noContent) | 205 if (_noContent) |
206 return -1; | 206 // return -1; |
207 throw new RuntimeException("_noContent"); | |
207 | 208 |
208 if (_last || _state==STATE_END) | 209 if (_last || _state==STATE_END) |
209 return -1; | 210 // return -1; |
211 throw new RuntimeException("_last"); | |
210 | 212 |
211 // Handle any unfinished business? | 213 // Handle any unfinished business? |
212 JBuffer content = _content; | 214 if (_content != null && _content.remaining()>0 || _bufferChunked) |
213 if (content != null && content.remaining()>0 || _bufferChunked) | |
214 { | 215 { |
215 flushBuffer(); | 216 flushBuffer(); |
216 if (content != null && content.remaining()>0 || _bufferChunked) | 217 if (_content != null && _content.remaining()>0 || _bufferChunked) |
217 throw new IllegalStateException("FULL"); | 218 throw new IllegalStateException("FULL"); |
218 } | 219 } |
219 | 220 |
220 // we better check we have a buffer | 221 _contentWritten -= _buffer.remaining(); |
221 if (_buffer == null) | 222 /* |
222 _buffer = _buffers.getBuffer(); | |
223 | |
224 _contentWritten-=_buffer.remaining(); | |
225 | |
226 // Handle the _content | 223 // Handle the _content |
227 if (_head) | 224 if (_head) |
228 return Integer.MAX_VALUE; | 225 return Integer.MAX_VALUE; |
229 | 226 |
230 return _buffer.space(); | 227 return _buffer.space(); |
228 */ | |
231 } | 229 } |
232 | 230 |
233 public boolean isBufferFull() | 231 public boolean isBufferFull() |
234 { | 232 { |
235 // Should we flush the buffers? | 233 // Should we flush the buffers? |
974 return _buffer.capacity(); | 972 return _buffer.capacity(); |
975 } | 973 } |
976 | 974 |
977 public final JBuffer getUncheckedBuffer() | 975 public final JBuffer getUncheckedBuffer() |
978 { | 976 { |
977 if (_buffer == null) | |
978 _buffer = _buffers.getBuffer(); | |
979 return _buffer; | 979 return _buffer; |
980 } | 980 } |
981 | 981 |
982 public final boolean isComplete() | 982 public final boolean isComplete() |
983 { | 983 { |
1062 } | 1062 } |
1063 } | 1063 } |
1064 | 1064 |
1065 public final void completeUncheckedAddContent() | 1065 public final void completeUncheckedAddContent() |
1066 { | 1066 { |
1067 if (_noContent) | 1067 _contentWritten += _buffer.remaining(); |
1068 { | 1068 if (_head) |
1069 if(_buffer!=null) | 1069 _buffer.clear(); |
1070 _buffer.clear(); | |
1071 } | |
1072 else | |
1073 { | |
1074 _contentWritten += _buffer.remaining(); | |
1075 if (_head) | |
1076 _buffer.clear(); | |
1077 } | |
1078 } | 1070 } |
1079 | 1071 |
1080 private boolean isBufferFull2() | 1072 private boolean isBufferFull2() |
1081 { | 1073 { |
1082 if (_buffer != null && _buffer.space()==0) | 1074 if (_buffer != null && _buffer.space()==0) |