Java ByteBuffer Get getNextTagNum(ByteBuffer message)

Here you can find the source of getNextTagNum(ByteBuffer message)

Description

Gets the next tag.

License

Open Source License

Parameter

Parameter Description
message IX message wrapped in a ByteBuffer

Return

next tag

Declaration

public static int getNextTagNum(ByteBuffer message) 

Method Source Code

//package com.java2s;
/*//from   w w  w.j  a  v  a  2 s  .  com
 *   Copyright (c) 2006-2016 Marvisan Pty. Ltd. All rights reserved.
 *               Use is subject to license terms.
 */

import java.nio.ByteBuffer;

public class Main {
    /**
     * Gets the next tag. Assumes that the  buffer position is located at the beginning of the
     * tag to retrieve. The given FIX message buffer pointer is advanced to the tag value.
     * @param message IX message wrapped in a ByteBuffer
     * @return next tag
     */
    public static int getNextTagNum(ByteBuffer message) {
        StringBuilder builder = new StringBuilder(10);
        int b;
        message.mark();
        while (message.hasRemaining()) {
            if ((b = message.get()) == ((int) '=')) {
                break;
            } else {
                builder.append((char) b);
            }
        }

        return Integer.parseInt(builder.toString());
    }
}

Related

  1. getMedium(ByteBuffer buffer)
  2. getMediumInt(ByteBuffer buffer)
  3. getModularShort(ByteBuffer bb)
  4. getMultiString(ByteBuffer bb, boolean wideChar)
  5. getNaluStartLength(ByteBuffer buffer)
  6. getNTString(ByteBuffer buffer)
  7. getNullTerminatedByte(ByteBuffer buffer)
  8. getNumeric(java.nio.ByteBuffer buffer, int len)
  9. getObject(ByteBuffer buffer)