com.noodlewiz.xjavab.ext.shape.internal.ReplyUnpacker.java Source code

Java tutorial

Introduction

Here is the source code for com.noodlewiz.xjavab.ext.shape.internal.ReplyUnpacker.java

Source

//
// DO NOT MODIFY!!! This file was machine generated. DO NOT MODIFY!!!
// 
// Copyright (c) 2014 Vincent W. Chen.
// 
// This file is part of XJavaB.
// 
// XJavaB is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// XJavaB is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with XJavaB.  If not, see <http://www.gnu.org/licenses/>.
//

package com.noodlewiz.xjavab.ext.shape.internal;

import java.nio.ByteBuffer;
import java.util.List;
import com.noodlewiz.xjavab.core.xproto.Rectangle;
import com.noodlewiz.xjavab.ext.shape.GetRectanglesReply;
import com.noodlewiz.xjavab.ext.shape.InputSelectedReply;
import com.noodlewiz.xjavab.ext.shape.QueryExtentsReply;
import com.noodlewiz.xjavab.ext.shape.QueryVersionReply;

public class ReplyUnpacker {

    public static QueryVersionReply unpackQueryVersion(final ByteBuffer __xjb_buf) {
        __xjb_buf.position(4);
        final long length = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        __xjb_buf.position(1);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 1);
        __xjb_buf.position(8);
        final int majorVersion = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int minorVersion = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        return new QueryVersionReply(majorVersion, minorVersion);
    }

    public static QueryExtentsReply unpackQueryExtents(final ByteBuffer __xjb_buf) {
        __xjb_buf.position(4);
        final long length = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        __xjb_buf.position(1);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 1);
        __xjb_buf.position(8);
        final boolean boundingShaped = com.noodlewiz.xjavab.core.internal.Unpacker.unpackBool(__xjb_buf);
        final boolean clipShaped = com.noodlewiz.xjavab.core.internal.Unpacker.unpackBool(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 2);
        final short boundingShapeExtentsX = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final short boundingShapeExtentsY = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final int boundingShapeExtentsWidth = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int boundingShapeExtentsHeight = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final short clipShapeExtentsX = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final short clipShapeExtentsY = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final int clipShapeExtentsWidth = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int clipShapeExtentsHeight = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        return new QueryExtentsReply(boundingShaped, clipShaped, boundingShapeExtentsX, boundingShapeExtentsY,
                boundingShapeExtentsWidth, boundingShapeExtentsHeight, clipShapeExtentsX, clipShapeExtentsY,
                clipShapeExtentsWidth, clipShapeExtentsHeight);
    }

    public static InputSelectedReply unpackInputSelected(final ByteBuffer __xjb_buf) {
        __xjb_buf.position(4);
        final long length = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        __xjb_buf.position(1);
        final boolean enabled = com.noodlewiz.xjavab.core.internal.Unpacker.unpackBool(__xjb_buf);
        __xjb_buf.position(8);
        return new InputSelectedReply(enabled);
    }

    public static GetRectanglesReply unpackGetRectangles(final ByteBuffer __xjb_buf) {
        __xjb_buf.position(4);
        final long length = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        __xjb_buf.position(1);
        final byte ordering = com.noodlewiz.xjavab.core.internal.Unpacker.unpackByte(__xjb_buf);
        __xjb_buf.position(8);
        final long rectanglesLen = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 20);
        final com.google.common.collect.ImmutableList.Builder<Rectangle> __xjb_rectanglesBuilder = new com.google.common.collect.ImmutableList.Builder<Rectangle>();
        for (int __xjb_i = 0; (__xjb_i < rectanglesLen); __xjb_i++) {
            __xjb_rectanglesBuilder
                    .add(com.noodlewiz.xjavab.core.xproto.internal.Unpacker.unpackRectangle(__xjb_buf));
        }
        final List<Rectangle> rectangles = __xjb_rectanglesBuilder.build();
        return new GetRectanglesReply(ordering, rectanglesLen, rectangles);
    }

}