Example usage for java.nio ByteOrder BIG_ENDIAN

List of usage examples for java.nio ByteOrder BIG_ENDIAN

Introduction

In this page you can find the example usage for java.nio ByteOrder BIG_ENDIAN.

Prototype

ByteOrder BIG_ENDIAN

To view the source code for java.nio ByteOrder BIG_ENDIAN.

Click Source Link

Document

This constant represents big endian.

Usage

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel two data maximum as a converted decimal float
 *
 * @return channelTwoMax - the 2 bytes of the channelTwoMax data as a float
 *///from   ww  w. j a  va2  s  .  c  o m
public float getChannelTwoMax() {
    this.channelTwoMax.flip();
    int channelData = (int) this.channelTwoMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel three data maximum as a converted decimal float
 *
 * @return channelThreeMax - the 2 bytes of the channelThreeMax data as a float
 *//*  w ww .j  a v a2 s  . c om*/
public float getChannelThreeMax() {
    this.channelThreeMax.flip();
    int channelData = (int) this.channelThreeMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel four data maximum as a converted decimal float
 *
 * @return channelFourMax - the 2 bytes of the channelFourMax data as a float
 *///from   w w w  .  j av  a  2  s.  c  o  m
public float getChannelFourMax() {
    this.channelFourMax.flip();
    int channelData = (int) this.channelFourMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel five data maximum as a converted decimal float
 *
 * @return channelFiveMax - the 2 bytes of the channelFiveMax data as a float
 *//* w w w . j a  v a  2s.  c  om*/
public float getChannelFiveMax() {
    this.channelFiveMax.flip();
    int channelData = (int) this.channelFiveMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel six data maximum as a converted decimal float
 *
 * @return channelSixMax - the 2 bytes of the channelSixMax data as a float
 *///from  w ww.  j a  v  a  2  s  .  c o  m
public float getChannelSixMax() {
    this.channelSixMax.flip();
    int channelData = (int) this.channelSixMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel seven data maximum as a converted decimal float
 *
 * @return channelSevenMax - the 2 bytes of the channelSevenMax data as a float
 *///from ww w . ja  v a 2s .co  m
public float getChannelSevenMax() {
    this.channelSevenMax.flip();
    int channelData = (int) this.channelSevenMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:com.linkedin.databus.core.DbusEventV1.java

private static int serializeStringKeyEvent(byte[] key, ByteBuffer serializationBuffer,
        DbusEventInfo eventInfo) {/*  w ww .j  a va  2 s .  co  m*/
    ByteBuffer valueBuffer = eventInfo.getValueByteBuffer();
    int payloadLen = (valueBuffer == null) ? eventInfo.getValueLength() : valueBuffer.remaining();

    int startPosition = serializationBuffer.position();
    byte[] attributes = null;

    // Event without explicit opcode specified should always be considered UPSERT or existing code will break
    if (eventInfo.getOpCode() == DbusOpcode.DELETE) {
        if (serializationBuffer.order() == ByteOrder.BIG_ENDIAN)
            attributes = DeleteStringKeyAttributesBigEndian.clone();
        else
            attributes = DeleteStringKeyAttributesLittleEndian.clone();
    } else {
        if (serializationBuffer.order() == ByteOrder.BIG_ENDIAN)
            attributes = UpsertStringKeyAttributesBigEndian.clone();
        else
            attributes = UpsertStringKeyAttributesLittleEndian.clone();
    }

    if (eventInfo.isEnableTracing()) {
        setTraceFlag(attributes, serializationBuffer.order());
    }

    if (eventInfo.isReplicated())
        setExtReplicationFlag(attributes, serializationBuffer.order());

    serializationBuffer.put(DbusEventFactory.DBUS_EVENT_V1).putInt(HeaderCrcDefault)
            .putInt(StringValueOffset(key.length) + payloadLen).put(attributes)
            .putLong(eventInfo.getSequenceId()).putShort(eventInfo.getpPartitionId())
            .putShort(eventInfo.getlPartitionId()).putLong(eventInfo.getTimeStampInNanos())
            .putShort(eventInfo.getSrcId()).put(eventInfo.getSchemaId(), 0, 16).putInt(HeaderCrcDefault)
            .putInt(key.length).put(key);
    if (valueBuffer != null) {
        // note. put will advance position. In the case of wrapped byte[] it is ok, in the case of
        // ByteBuffer this is actually a read only copy of the buffer passed in.
        serializationBuffer.put(valueBuffer);
    }

    int stopPosition = serializationBuffer.position();
    long valueCrc = ByteBufferCRC32.getChecksum(serializationBuffer, startPosition + StringKeyOffset,
            key.length + payloadLen);
    Utils.putUnsignedInt(serializationBuffer, startPosition + ValueCrcOffset, valueCrc);
    if (eventInfo.isAutocommit()) {
        //TODO (DDSDBUS-61): Medium : can avoid new here
        DbusEventV1 e = new DbusEventV1(serializationBuffer, startPosition);
        e.applyCrc();
    }

    serializationBuffer.position(stopPosition);
    return (stopPosition - startPosition);
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel average maximum data as a converted decimal float
 *
 * @return channelAverageMax - the 2 bytes of the channelAverageMax data as a float
 *///  w  w w.ja  va  2  s . c o m
public float getChannelAverageMax() {
    this.channelAverageMax.flip();
    int channelData = (int) this.channelAverageMax.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}

From source file:com.healthmarketscience.jackcess.impl.ColumnImpl.java

/**
 * Decodes a NUMERIC field./*from   ww w . java 2  s.  co  m*/
 */
private BigDecimal readNumericValue(ByteBuffer buffer) {
    boolean negate = (buffer.get() != 0);

    byte[] tmpArr = ByteUtil.getBytes(buffer, 16);

    if (buffer.order() != ByteOrder.BIG_ENDIAN) {
        fixNumericByteOrder(tmpArr);
    }

    return toBigDecimal(tmpArr, negate, getScale());
}

From source file:edu.hawaii.soest.kilonalu.adam.AdamParser.java

/**
 * A method that gets the channel zero mimimum data as a converted decimal float
 *
 * @return channelZeroMin  - the 2 bytes of the channelZeroMin data as a float
 *//*from w  ww . j  ava  2s.  co  m*/
public float getChannelZeroMin() {
    this.channelZeroMin.flip();
    int channelData = (int) this.channelZeroMin.order(ByteOrder.BIG_ENDIAN).getShort();

    return getVoltage(channelData);
}