public int size() {
   return buffer.getLength();
 }