@Override public void put(String value) { if (_first.hasRemaining()) { byte[] utf8Bytes = value.getBytes(StandardCharsets.UTF_8); put(utf8Bytes, 0, utf8Bytes.length); } else { _second.put(value); } } }
public void putShort(short s) { int remaining = _first.remaining(); if(remaining >= 2) { _first.putShort(s); } else if(remaining ==0 ) { _second.putShort(s); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[2]); wrap.putShort(s); wrap.flip(); put(wrap); } }
public void putLong(long l) { int remaining = _first.remaining(); if(remaining >= 8) { _first.putLong(l); } else if(remaining ==0 ) { _second.putLong(l); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[8]); wrap.putLong(l); wrap.flip(); put(wrap); } }
public void putLong(long l) { int remaining = _first.remaining(); if(remaining >= 8) { _first.putLong(l); } else if(remaining ==0 ) { _second.putLong(l); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[8]); wrap.putLong(l); wrap.flip(); put(wrap); } }
public void putInt(int i) { int remaining = _first.remaining(); if(remaining >= 4) { _first.putInt(i); } else if(remaining ==0 ) { _second.putInt(i); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[4]); wrap.putInt(i); wrap.flip(); put(wrap); } }
public void putShort(short s) { int remaining = _first.remaining(); if(remaining >= 2) { _first.putShort(s); } else if(remaining ==0 ) { _second.putShort(s); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[2]); wrap.putShort(s); wrap.flip(); put(wrap); } }
@Override public void putShort(short s) { int remaining = _first.remaining(); if(remaining >= 2) { _first.putShort(s); } else if(remaining ==0 ) { _second.putShort(s); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[2]); wrap.putShort(s); wrap.flip(); put(wrap); } }
@Override public void putLong(long l) { int remaining = _first.remaining(); if(remaining >= 8) { _first.putLong(l); } else if(remaining ==0 ) { _second.putLong(l); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[8]); wrap.putLong(l); wrap.flip(); put(wrap); } }
public void putLong(long l) { int remaining = _first.remaining(); if(remaining >= 8) { _first.putLong(l); } else if(remaining ==0 ) { _second.putLong(l); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[8]); wrap.putLong(l); wrap.flip(); put(wrap); } }
public void putInt(int i) { int remaining = _first.remaining(); if(remaining >= 4) { _first.putInt(i); } else if(remaining ==0 ) { _second.putInt(i); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[4]); wrap.putInt(i); wrap.flip(); put(wrap); } }
public void putShort(short s) { int remaining = _first.remaining(); if(remaining >= 2) { _first.putShort(s); } else if(remaining ==0 ) { _second.putShort(s); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[2]); wrap.putShort(s); wrap.flip(); put(wrap); } }
public void putInt(int i) { int remaining = _first.remaining(); if(remaining >= 4) { _first.putInt(i); } else if(remaining ==0 ) { _second.putInt(i); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[4]); wrap.putInt(i); wrap.flip(); put(wrap); } }
@Override public void putInt(int i) { int remaining = _first.remaining(); if(remaining >= 4) { _first.putInt(i); } else if(remaining ==0 ) { _second.putInt(i); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[4]); wrap.putInt(i); wrap.flip(); put(wrap); } }