Java ByteBuffer Serialize serializeNull(ByteBuffer buf)

Here you can find the source of serializeNull(ByteBuffer buf)

Description

Serialize the null decimal sigil to a the provided java.nio.ByteBuffer ByteBuffer

License

Open Source License

Parameter

Parameter Description
buf <code>ByteBuffer</code> to serialize the decimal into

Declaration

static public void serializeNull(ByteBuffer buf) 

Method Source Code

//package com.java2s;
/* This file is part of VoltDB.
 * Copyright (C) 2008-2015 VoltDB Inc.//w  w w  .  j  a v  a  2s  . c  o m
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.math.BigInteger;

import java.nio.ByteBuffer;

public class Main {
    /**
     * Array containing the smallest 16-byte twos complement value that is used
     * as SQL null.
     */
    private static final byte[] NULL_INDICATOR = new BigInteger(
            "-170141183460469231731687303715884105728").toByteArray();

    /**
     * Serialize the null decimal sigil to a the provided {@link java.nio.ByteBuffer ByteBuffer}
     * @param buf <code>ByteBuffer</code> to serialize the decimal into
     */
    static public void serializeNull(ByteBuffer buf) {
        buf.put(NULL_INDICATOR);
    }
}

Related

  1. deserialize(ByteBuffer byteBuffer)
  2. deserializeBoolean(ByteBuffer buf)
  3. deserializeFromByteBufferNoHeader(ByteBuffer bytes)
  4. deserializeObject(ByteBuffer obj)
  5. serializeBigDecimal(BigDecimal bd, ByteBuffer buf)
  6. serializeString(final String value, ByteBuffer buffer)
  7. serializeStringArray(ByteBuffer buf, String[] strArray)