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

Java tutorial

Introduction

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

import java.nio.ByteBuffer;
import java.util.List;
import com.noodlewiz.xjavab.core.xproto.Str;
import com.noodlewiz.xjavab.ext.render.Indexvalue;
import com.noodlewiz.xjavab.ext.render.Pictforminfo;
import com.noodlewiz.xjavab.ext.render.Pictscreen;
import com.noodlewiz.xjavab.ext.render.QueryFiltersReply;
import com.noodlewiz.xjavab.ext.render.QueryPictFormatsReply;
import com.noodlewiz.xjavab.ext.render.QueryPictIndexValuesReply;
import com.noodlewiz.xjavab.ext.render.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 QueryPictFormatsReply unpackQueryPictFormats(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 numFormats = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long numScreens = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long numDepths = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long numVisuals = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long numSubpixel = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 4);
        final com.google.common.collect.ImmutableList.Builder<Pictforminfo> __xjb_formatsBuilder = new com.google.common.collect.ImmutableList.Builder<Pictforminfo>();
        for (int __xjb_i = 0; (__xjb_i < numFormats); __xjb_i++) {
            __xjb_formatsBuilder
                    .add(com.noodlewiz.xjavab.ext.render.internal.Unpacker.unpackPictforminfo(__xjb_buf));
        }
        final List<Pictforminfo> formats = __xjb_formatsBuilder.build();
        final com.google.common.collect.ImmutableList.Builder<Pictscreen> __xjb_screensBuilder = new com.google.common.collect.ImmutableList.Builder<Pictscreen>();
        for (int __xjb_i = 0; (__xjb_i < numScreens); __xjb_i++) {
            __xjb_screensBuilder.add(com.noodlewiz.xjavab.ext.render.internal.Unpacker.unpackPictscreen(__xjb_buf));
        }
        final List<Pictscreen> screens = __xjb_screensBuilder.build();
        final com.google.common.collect.ImmutableList.Builder<Long> __xjb_subpixelsBuilder = new com.google.common.collect.ImmutableList.Builder<Long>();
        for (int __xjb_i = 0; (__xjb_i < numSubpixel); __xjb_i++) {
            __xjb_subpixelsBuilder.add(com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf));
        }
        final List<Long> subpixels = __xjb_subpixelsBuilder.build();
        return new QueryPictFormatsReply(numFormats, numScreens, numDepths, numVisuals, numSubpixel, formats,
                screens, subpixels);
    }

    public static QueryPictIndexValuesReply unpackQueryPictIndexValues(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 numValues = 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<Indexvalue> __xjb_valuesBuilder = new com.google.common.collect.ImmutableList.Builder<Indexvalue>();
        for (int __xjb_i = 0; (__xjb_i < numValues); __xjb_i++) {
            __xjb_valuesBuilder.add(com.noodlewiz.xjavab.ext.render.internal.Unpacker.unpackIndexvalue(__xjb_buf));
        }
        final List<Indexvalue> values = __xjb_valuesBuilder.build();
        return new QueryPictIndexValuesReply(numValues, values);
    }

    public static QueryFiltersReply unpackQueryFilters(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 numAliases = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        final long numFilters = com.noodlewiz.xjavab.core.internal.Unpacker.unpackUInt(__xjb_buf);
        com.noodlewiz.xjavab.core.internal.Unpacker.unpackPad(__xjb_buf, 16);
        final com.google.common.collect.ImmutableList.Builder<Integer> __xjb_aliasesBuilder = new com.google.common.collect.ImmutableList.Builder<Integer>();
        for (int __xjb_i = 0; (__xjb_i < numAliases); __xjb_i++) {
            __xjb_aliasesBuilder.add(com.noodlewiz.xjavab.core.internal.Unpacker.unpackUShort(__xjb_buf));
        }
        final List<Integer> aliases = __xjb_aliasesBuilder.build();
        final com.google.common.collect.ImmutableList.Builder<Str> __xjb_filtersBuilder = new com.google.common.collect.ImmutableList.Builder<Str>();
        for (int __xjb_i = 0; (__xjb_i < numFilters); __xjb_i++) {
            __xjb_filtersBuilder.add(com.noodlewiz.xjavab.core.xproto.internal.Unpacker.unpackStr(__xjb_buf));
        }
        final List<Str> filters = __xjb_filtersBuilder.build();
        return new QueryFiltersReply(numAliases, numFilters, aliases, filters);
    }

}