comparison src/org/eclipse/jetty/io/AbstractBuffer.java @ 1041:35e3c864d7a7

make View package local
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 04 Nov 2016 00:47:23 -0600
parents 3e4949834f3e
children a62193321d6a
comparison
equal deleted inserted replaced
1040:3e4949834f3e 1041:35e3c864d7a7
45 protected int _put; 45 protected int _put;
46 protected int _hash; 46 protected int _hash;
47 protected int _hashGet; 47 protected int _hashGet;
48 protected int _hashPut; 48 protected int _hashPut;
49 protected int _mark; 49 protected int _mark;
50 protected View _view;
51 50
52 /** 51 /**
53 * Constructor for BufferView 52 * Constructor for BufferView
54 * 53 *
55 * @param access 1==READONLY, 2==READWRITE 54 * @param access 1==READONLY, 2==READWRITE
241 return peek(_get); 240 return peek(_get);
242 } 241 }
243 242
244 private Buffer peek(int index, int length) 243 private Buffer peek(int index, int length)
245 { 244 {
246 if (_view == null) 245 Buffer view = duplicate();
247 { 246 view.setPutIndex(index + length);
248 _view = new View(this, -1, index, index + length, isReadOnly() ? READONLY : READWRITE); 247 view.setGetIndex(index);
249 } 248 return view;
250 else
251 {
252 _view.update(this.buffer());
253 _view.setMarkIndex(-1);
254 _view.setGetIndex(0);
255 _view.setPutIndex(index + length);
256 _view.setGetIndex(index);
257
258 }
259 return _view;
260 } 249 }
261 250
262 @Override 251 @Override
263 public int poke(int index, Buffer src) 252 public int poke(int index, Buffer src)
264 { 253 {
542 s-=l; 531 s-=l;
543 } 532 }
544 return total; 533 return total;
545 } 534 }
546 } 535 }
536
537 public final Buffer duplicate() {
538 return new View(this);
539 }
547 } 540 }