@Override
  public void flushBufferStopAtMark() throws IOException {
    final int end = pos;
    pos = mark;
    flushBuffer(true);
    out.flush();
    startPacket(0);

    System.arraycopy(buf, mark, buf, pos, end - mark);
    pos += end - mark;
    mark = -1;
    bufferContainDataAfterMark = true;
  }
@ Override public void flushBufferStopAtMark ( ) throws IOException { final int end = pos ; pos = mark ; flushBuffer ( true ) ; out . flush ( ) ; startPacket ( 0 ) ; System . arraycopy ( buf , mark , buf , pos , end - mark ) ; pos += end - mark ; mark = - 1 ; bufferContainDataAfterMark = true ; }
Flush to last mark.

@throws IOException if flush fail.