Java ByteBuffer Write writeResBit15(int value, ByteBuffer toBuffer)

Here you can find the source of writeResBit15(int value, ByteBuffer toBuffer)

Description

write Res Bit

License

Apache License

Declaration

static void writeResBit15(int value, ByteBuffer toBuffer) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    static void writeResBit15(int value, ByteBuffer toBuffer) {
        if (value < 0x80) {
            toBuffer.put((byte) value);
        } else {//from   w  w w.  j a  v  a  2 s.  c o  m
            toBuffer.putShort((short) (value | 0x8000));
        }
    }
}

Related

  1. writeLong(long v, ByteBuffer buffer)
  2. writeLTriad(int triad, ByteBuffer bb)
  3. writeNullTerminatedString(ByteBuffer buf, String s, String encoding)
  4. writePackageName(ByteBuffer buffer, String packageName)
  5. writeRemaining(WritableByteChannel channel, ByteBuffer buffer)
  6. writeShortString(ByteBuffer buffer, String s)
  7. writeSign(ByteBuffer bb)
  8. writeSignedVarint(ByteBuffer buffer, int val)
  9. writeSize(final int s, ByteBuffer buffer)