Here you can find the source of bytesToBool(byte[] data, int[] offset)
boolean
represented by the bytes in data
staring at offset offset[0]
.
Parameter | Description |
---|---|
data | the array from which to read |
offset | A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. |
boolean
decoded
public static final boolean bytesToBool(byte[] data, int[] offset)
//package com.java2s; /*/*w w w.j ava 2 s .c o m*/ * JGrass - Free Open Source Java GIS http://www.jgrass.org * (C) HydroloGIS - www.hydrologis.com * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Library General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) any * later version. * * This library 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 Library General Public License for more * details. * * You should have received a copy of the GNU Library General Public License * along with this library; if not, write to the Free Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ public class Main { public static final int SIZE_BOOL = 1; /** * Return the <code>boolean</code> represented by the bytes in * <code>data</code> staring at offset <code>offset[0]</code>. * * @param data the array from which to read * @param offset A single element array whose first element is the index in * data from which to begin reading on function entry, and which * on function exit has been incremented by the number of bytes * read. * * @return the value of the <code>boolean</code> decoded */ public static final boolean bytesToBool(byte[] data, int[] offset) { boolean result = true; if (data[offset[0]] == 0) { result = false; } offset[0] += SIZE_BOOL; return result; } }