comparison src/org/eclipse/jetty/http/AbstractGenerator.java @ 1038:b71ad168fe34

rename Buffer.length() to remaining()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 22:16:11 -0600
parents b87f97f6418a
children a7319f14ba1e
comparison
equal deleted inserted replaced
1037:3c4c7cc7904f 1038:b71ad168fe34
233 if(_buffer!=null) 233 if(_buffer!=null)
234 _buffer.clear(); 234 _buffer.clear();
235 } 235 }
236 else 236 else
237 { 237 {
238 _contentWritten+=_buffer.length(); 238 _contentWritten+=_buffer.remaining();
239 if (_head) 239 if (_head)
240 _buffer.clear(); 240 _buffer.clear();
241 } 241 }
242 } 242 }
243 243
244 public boolean isBufferFull() 244 public boolean isBufferFull()
245 { 245 {
246 if (_buffer != null && _buffer.space()==0) 246 if (_buffer != null && _buffer.space()==0)
247 { 247 {
248 if (_buffer.length()==0 && !_buffer.isImmutable()) 248 if (_buffer.remaining()==0 && !_buffer.isImmutable())
249 _buffer.compact(); 249 _buffer.compact();
250 return _buffer.space()==0; 250 return _buffer.space()==0;
251 } 251 }
252 252
253 return _content!=null && _content.length()>0; 253 return _content!=null && _content.remaining()>0;
254 } 254 }
255 255
256 public final boolean isWritten() 256 public final boolean isWritten()
257 { 257 {
258 return _contentWritten>0; 258 return _contentWritten>0;
294 // block until everything is flushed 294 // block until everything is flushed
295 long now=System.currentTimeMillis(); 295 long now=System.currentTimeMillis();
296 long end=now+maxIdleTime; 296 long end=now+maxIdleTime;
297 Buffer content = _content; 297 Buffer content = _content;
298 Buffer buffer = _buffer; 298 Buffer buffer = _buffer;
299 if (content!=null && content.length()>0 || buffer!=null && buffer.length()>0 || isBufferFull()) 299 if (content!=null && content.remaining()>0 || buffer!=null && buffer.remaining()>0 || isBufferFull())
300 { 300 {
301 flushBuffer(); 301 flushBuffer();
302 302
303 while (now<end && (content!=null && content.length()>0 ||buffer!=null && buffer.length()>0) && _endp.isOpen()&& !_endp.isOutputShutdown()) 303 while (now<end && (content!=null && content.remaining()>0 ||buffer!=null && buffer.remaining()>0) && _endp.isOpen()&& !_endp.isOutputShutdown())
304 { 304 {
305 blockForOutput(end-now); 305 blockForOutput(end-now);
306 now=System.currentTimeMillis(); 306 now=System.currentTimeMillis();
307 } 307 }
308 } 308 }