Code example for ByteBuffer

Methods: getInt, getShort

0
        return 8; 
    } 
 
    @Override 
    public void readFrom(ByteBuffer data) {
        this.portNumber = data.getShort();
        data.getShort(); // pad
        this.queueId = data.getInt();
    } 
 
    @Override 
    public void writeTo(ByteBuffer data) {
        data.putShort(this.portNumber);
        data.putShort((short) 0); // pad
        data.putInt(this.queueId);
    } 
 
    @Override 
    public int hashCode() { 
        final int prime = 443;
        int result = 1;