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

Java tutorial

Introduction

Here is the source code for com.noodlewiz.xjavab.ext.xfixes.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.xfixes.internal;

import java.nio.ByteBuffer;
import java.util.List;
import com.noodlewiz.xjavab.ext.xfixes.FetchRegionReply;
import com.noodlewiz.xjavab.ext.xfixes.GetCursorImageAndNameReply;
import com.noodlewiz.xjavab.ext.xfixes.GetCursorImageReply;
import com.noodlewiz.xjavab.ext.xfixes.GetCursorNameReply;
import com.noodlewiz.xjavab.ext.xfixes.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 long majorVersion = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long minorVersion = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 16);
        return new QueryVersionReply(majorVersion, minorVersion);
    }

    public static GetCursorImageReply unpackGetCursorImage(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 short x = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final short y = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final int width = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int height = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int xhot = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int yhot = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final long cursorSerial = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 8);
        final com.google.common.collect.ImmutableList.Builder<Long> __xjb_cursorImageBuilder = new com.google.common.collect.ImmutableList.Builder<Long>();
        for (int __xjb_i = 0; (__xjb_i < (width * height)); __xjb_i++) {
            __xjb_cursorImageBuilder.add(com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf));
        }
        final List<Long> cursorImage = __xjb_cursorImageBuilder.build();
        return new GetCursorImageReply(x, y, width, height, xhot, yhot, cursorSerial, cursorImage);
    }

    public static FetchRegionReply unpackFetchRegion(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 com.noodlewiz.xjavab.core.xproto.Rectangle extents = com.noodlewiz.xjavab.core.xproto.internal.Unpacker
                .unpackRectangle(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 16);
        final com.google.common.collect.ImmutableList.Builder<com.noodlewiz.xjavab.core.xproto.Rectangle> __xjb_rectanglesBuilder = new com.google.common.collect.ImmutableList.Builder<com.noodlewiz.xjavab.core.xproto.Rectangle>();
        for (int __xjb_i = 0; (__xjb_i < (length * 2)); __xjb_i++) {
            __xjb_rectanglesBuilder
                    .add(com.noodlewiz.xjavab.core.xproto.internal.Unpacker.unpackRectangle(__xjb_buf));
        }
        final List<com.noodlewiz.xjavab.core.xproto.Rectangle> rectangles = __xjb_rectanglesBuilder.build();
        return new FetchRegionReply(extents, rectangles);
    }

    public static GetCursorNameReply unpackGetCursorName(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 long atom = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final int nbytes = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 18);
        final String name = com.noodlewiz.xjavab.core.internal.Unpacker.unpackString(__xjb_buf, nbytes);
        return new GetCursorNameReply(atom, nbytes, name);
    }

    public static GetCursorImageAndNameReply unpackGetCursorImageAndName(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 short x = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final short y = com.noodlewiz.xjavab.core.internal.Unpacker.unpackShort(__xjb_buf);
        final int width = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int height = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int xhot = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final int yhot = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        final long cursorSerial = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long cursorAtom = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final int nbytes = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 2);
        final String name = com.noodlewiz.xjavab.core.internal.Unpacker.unpackString(__xjb_buf, nbytes);
        final com.google.common.collect.ImmutableList.Builder<Long> __xjb_cursorImageBuilder = new com.google.common.collect.ImmutableList.Builder<Long>();
        for (int __xjb_i = 0; (__xjb_i < (width * height)); __xjb_i++) {
            __xjb_cursorImageBuilder.add(com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf));
        }
        final List<Long> cursorImage = __xjb_cursorImageBuilder.build();
        return new GetCursorImageAndNameReply(x, y, width, height, xhot, yhot, cursorSerial, cursorAtom, nbytes,
                name, cursorImage);
    }

}