Java Utililty Methods ByteBuffer Fill

List of utility methods to do ByteBuffer Fill

  1. HOME
  2. Java
  3. B
  4. ByteBuffer Fill

Description

The list of methods to do ByteBuffer Fill are organized into topic(s).

Method

void fill(ByteBuffer buffer, int off, int len, byte val)
fill
buffer.position(off);
while (--len >= 0)
 buffer.put(val);
void fill(ByteBuffer buffer, int position, int length, byte filler)
fill
if (buffer.hasArray())
 Arrays.fill(buffer.array(), position, length, filler);
else {
 for (int i = position; i < length; i++) {
 buffer.put(filler);
int fill(ByteBuffer to, byte[] b, int off, int len)
Like append, but does not throw BufferOverflowException
int pos = flipToFill(to);
try {
 int remaining = to.remaining();
 int take = remaining < len ? remaining : len;
 to.put(b, off, take);
 return take;
} finally {
 flipToFlush(to, pos);
...
Buffer fillBuffer(ByteBuffer buffer, byte[] bytes)
fill Buffer
for (byte b : bytes) {
 buffer.put(b);
return buffer;
void fillBuffer(ByteBuffer buffer, int seed)
fill Buffer
Random rnd = new Random(seed);
while (buffer.remaining() != 0)
 buffer.putInt(rnd.nextInt());
buffer.rewind();
void fillBufFromTime(ByteBuffer buf, Calendar cal)
fill Buf From Time
buf.putChar((char) cal.get(Calendar.YEAR));
buf.put((byte) (cal.get(Calendar.MONTH) + 1));
buf.put((byte) cal.get(Calendar.DAY_OF_MONTH));
buf.put((byte) cal.get(Calendar.HOUR_OF_DAY));
buf.put((byte) cal.get(Calendar.MINUTE));
buf.put((byte) cal.get(Calendar.SECOND));
ByteBuffer fillDdsBuffer(ByteBuffer buf)
fill Dds Buffer
buf.rewind();
buf.putInt(ddsNumber);
buf.put((byte) (ddsAcknowledged ? 1 : 0));
buf.putInt(ddsDescription.length());
for (int i = 0; i < ddsDescription.length(); i++) {
 buf.putChar(ddsDescription.charAt(i));
buf.putFloat(ddsPrecision);
...
ByteBuffer fillHlaBuffer(ByteBuffer buf)
fill Hla Buffer
String name = hlaName;
int messageLength = 1 + 4 + 4 + 2 * name.length();
if (messageLength > MAX_BUFFER_SIZE) {
 int extraMessageLength = messageLength - MAX_BUFFER_SIZE;
 name = name.substring(0, name.length() - (extraMessageLength / 2));
buf.rewind();
buf.put((byte) (hlaOk ? 1 : 0));
...
void fillRange(ByteBuffer buffer, int start, int end)
Sets all bits in the given byte range to 1.
putRange(buffer, start, end, (byte) 0xff);


AltStyle によって変換されたページ (->オリジナル) /