Example usage for io.netty.buffer ByteBuf skipBytes

List of usage examples for io.netty.buffer ByteBuf skipBytes

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf skipBytes.

Prototype

public abstract ByteBuf skipBytes(int length);

Source Link

Document

Increases the current readerIndex by the specified length in this buffer.

Usage

From source file:com.tesora.dve.db.mysql.libmy.MyFieldPktResponse.java

License:Open Source License

private void unpackNameInfo(ByteBuf cb) {
    catalog = MysqlAPIUtils.getLengthCodedString(cb);
    database = MysqlAPIUtils.getLengthCodedString(cb);
    table = MysqlAPIUtils.getLengthCodedString(cb);
    orig_table = MysqlAPIUtils.getLengthCodedString(cb);
    column = MysqlAPIUtils.getLengthCodedString(cb);
    orig_column = MysqlAPIUtils.getLengthCodedString(cb);
    cb.skipBytes(1);
}

From source file:com.tesora.dve.db.mysql.libmy.MyHandshakeV10.java

License:Open Source License

@Override
public void unmarshallMessage(ByteBuf cb) {
    protocolVersion = cb.readByte();//from   www  . j  a v a2s .  c om
    serverVersion = cb.readSlice(cb.bytesBefore((byte) 0)).toString(CharsetUtil.UTF_8);
    cb.skipBytes(1); // skip the NULL terminator
    threadID = cb.readInt();
    scrambleBuffer1st = MysqlAPIUtils.readBytesAsString(cb, 8, CharsetUtil.ISO_8859_1);
    cb.skipBytes(1);
    long sc1 = cb.readUnsignedShort();
    serverCharset = cb.readByte();
    serverStatus = cb.readShort();
    long sc2 = Long.rotateLeft(cb.readUnsignedShort(), 16);
    setServerCapabilities(sc1 + sc2);
    scrambleBufferSize = new Integer(cb.readByte());
    cb.skipBytes(10); //unused bytes
    scrambleBuffer2nd = cb.readSlice(cb.bytesBefore((byte) 0)).toString(CharsetUtil.ISO_8859_1);
    cb.skipBytes(1);
    if ((serverCapabilitiesasLong
            & ClientCapabilities.CLIENT_PLUGIN_AUTH) == ClientCapabilities.CLIENT_PLUGIN_AUTH) {
        plugInProvidedData = cb.readSlice(cb.bytesBefore((byte) 0)).toString(CharsetUtil.UTF_8);
    }
}

From source file:com.tesora.dve.db.mysql.libmy.MyLoginRequest.java

License:Open Source License

@Override
public void unmarshallMessage(ByteBuf cb) {
    clientCapabilities = cb.readUnsignedInt();
    boolean hasConnectDatabase = ((clientCapabilities
            & ClientCapabilities.CLIENT_CONNECT_WITH_DB) == ClientCapabilities.CLIENT_CONNECT_WITH_DB);
    maxPacketSize = cb.readInt();/*from www  . ja  v a2  s.  co m*/
    clientCharset = cb.readByte();

    cb.skipBytes(23); // login request has a 23 byte filler
    username = cb.readSlice(cb.bytesBefore((byte) 0)).toString(CharsetUtil.UTF_8);
    cb.skipBytes(1); // skip the NULL terminator
    byte passwordLength = cb.readByte();
    byte[] passwordBytes = new byte[passwordLength];
    cb.getBytes(cb.readerIndex(), passwordBytes, 0, passwordLength);
    password = new String(passwordBytes, CharsetUtil.ISO_8859_1);
    cb.skipBytes(passwordLength);
    // if the clientCapabilities flag has the CLIENT_CONNECT_WITH_DB bit set,
    // then this message contains an initial database to connect to
    if (hasConnectDatabase) {
        database = cb.readSlice(cb.bytesBefore((byte) 0)).toString(CharsetUtil.UTF_8);
        if (database.length() < 1) {
            database = null;
        }
    }
}

From source file:com.tesora.dve.db.mysql.libmy.MyPrepareOKResponse.java

License:Open Source License

@Override
public void unmarshallMessage(ByteBuf cb) {
    cb.skipBytes(1);
    stmtId = cb.readInt();/*  ww  w.j  a  v a 2 s.c o m*/
    numColumns = cb.readUnsignedShort();
    numParams = cb.readUnsignedShort();
    cb.skipBytes(1);
    warningCount = cb.readShort();
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPAuthenticateV10MessageMessage.java

License:Open Source License

@Override
protected ParsedData unmarshall(ByteBuf source) {
    ParsedData parseValues = new ParsedData();
    parseValues.caps = new ClientCapabilities(source.readUnsignedInt());
    parseValues.maxPacketSize = source.readInt();
    parseValues.charsetID = source.readByte();

    source.skipBytes(23); // login request has a 23 byte filler
    parseValues.username = source.readSlice(source.bytesBefore((byte) 0)).toString(CharsetUtil.UTF_8);
    source.skipBytes(1); // skip the NULL terminator
    byte passwordLength = source.readByte();
    parseValues.password = source.readSlice(passwordLength).toString(CharsetUtil.ISO_8859_1);

    // if the clientCapabilities flag has the CLIENT_CONNECT_WITH_DB bit set,
    // then this message contains an initial database to connect to
    if (parseValues.caps.connectWithDB()) {
        parseValues.initialDatabase = source.readSlice(source.bytesBefore((byte) 0))
                .toString(CharsetUtil.UTF_8);
        source.skipBytes(1); // skip the NULL terminator
    } else {/*  w ww  . j a  va2 s. c  o  m*/
        parseValues.initialDatabase = "";
    }
    return parseValues;
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComInitDBRequestMessage.java

License:Open Source License

@Override
protected String unmarshall(ByteBuf source) {
    if (decodingCharset == null)
        throw new IllegalStateException(
                "initDB request cannot unmarshall a packet without a decoding charset.");
    source.skipBytes(1);//skip type field.
    return source.toString(decodingCharset);
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComPrepareStmtRequestMessage.java

License:Open Source License

@Override
protected String unmarshall(ByteBuf source) {
    source.skipBytes(1);//skip type field.
    return source.toString(decodingCharset);
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComSetOptionRequestMessage.java

License:Open Source License

@Override
protected Short unmarshall(ByteBuf source) {
    source.skipBytes(1);//toss message identifier
    return source.getShort(INDEX_OF_OPTIONFLAG);
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComStmtCloseRequestMessage.java

License:Open Source License

@Override
protected Long unmarshall(ByteBuf source) {
    source.skipBytes(1);
    return source.getUnsignedInt(INDEX_OF_STATEMENTID);
}

From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComStmtExecuteRequestMessage.java

License:Open Source License

@Override
protected ParsedData unmarshall(ByteBuf source) {
    ParsedData parseValues = new ParsedData();
    source.skipBytes(1);//skip the type identifier.
    parseValues.statementID = source.readUnsignedInt();
    parseValues.flags = source.readByte();
    parseValues.iterationCount = source.readUnsignedInt();
    parseValues.metadataOffset = source.readerIndex();

    //we don't actually unmarshall the metadata and values here, since we don't know how many parameters there are.
    parseValues.metadata = null;/*  www  .  j a v  a 2 s.com*/
    parseValues.values = null;
    return parseValues;
}