Java ByteBuffer Dump dumpBoolean(ByteBuffer itemBuffer, StringBuilder sb, String tag)

Here you can find the source of dumpBoolean(ByteBuffer itemBuffer, StringBuilder sb, String tag)

Description

dump Boolean

License

Open Source License

Declaration

public static boolean dumpBoolean(ByteBuffer itemBuffer, StringBuilder sb, String tag) 

Method Source Code


//package com.java2s;
/*-/*from   www .  ja v  a  2  s  . c  o m*/
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002-2010 Oracle.  All rights reserved.
 *
 */

import java.nio.ByteBuffer;

public class Main {
    public static boolean dumpBoolean(ByteBuffer itemBuffer, StringBuilder sb, String tag) {
        sb.append("<");
        sb.append(tag);
        sb.append(" exists = \"");
        boolean exists = readBoolean(itemBuffer);
        sb.append(exists);
        if (exists) {
            sb.append("\">");
        } else {
            /* Close off the tag, we're done. */
            sb.append("\"/>");
        }
        return exists;
    }

    /**
     * Read a boolean from the log.
     */
    public static boolean readBoolean(ByteBuffer logBuf) {
        byte val = logBuf.get();
        return (val == (byte) 1) ? true : false;
    }
}

Related

  1. dump(ByteBuffer buffer)
  2. dump(ByteBuffer buffer)
  3. dump(ByteBuffer buffer, int pos, int limit)
  4. dump(ByteBuffer buffer, OutputStream stream)
  5. dumpAsHex(byte[] byteBuffer, int length)
  6. dumpBytes(ByteBuffer bbuf)
  7. dumpBytes(ByteBuffer byteBuffer)
  8. dumpBytes(PrintStream ps, ByteBuffer buf)
  9. dumpHexString(ByteBuffer bb)