Example usage for com.google.common.primitives UnsignedInteger fromIntBits

List of usage examples for com.google.common.primitives UnsignedInteger fromIntBits

Introduction

In this page you can find the example usage for com.google.common.primitives UnsignedInteger fromIntBits.

Prototype

public static UnsignedInteger fromIntBits(int bits) 

Source Link

Document

Returns an UnsignedInteger corresponding to a given bit representation.

Usage

From source file:com.facebook.buck.macho.FatHeaderUtils.java

public static FatHeader createFromBuffer(ByteBuffer buffer) {
    return FatHeader.of(UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()));
}

From source file:com.facebook.buck.macho.FatArchUtils.java

public static FatArch createFromBuffer(ByteBuffer buffer) {
    return FatArch.of(buffer.getInt(), buffer.getInt(), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()));
}

From source file:com.facebook.buck.macho.LoadCommandCommonFieldsUtils.java

public static LoadCommandCommonFields createFromBuffer(ByteBuffer buffer) {
    return LoadCommandCommonFields.of(buffer.position(), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()));
}

From source file:com.facebook.buck.macho.LinkEditDataCommandUtils.java

public static LinkEditDataCommand createFromBuffer(ByteBuffer buffer) {
    return LinkEditDataCommand.of(LoadCommandCommonFieldsUtils.createFromBuffer(buffer),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()));
}

From source file:com.spotify.crtauth.utils.TimeIntervals.java

public static boolean isExpired(int validFrom, int validTo, TimeSupplier timeSupplier) {
    UnsignedInteger currentUTime = timeSupplier.getTime();
    UnsignedInteger validUFrom = UnsignedInteger.fromIntBits(validFrom);
    UnsignedInteger validUTo = UnsignedInteger.fromIntBits(validTo);
    if (validUFrom.compareTo(currentUTime) > 0 || validUTo.compareTo(currentUTime) < 0) {
        return true;
    }/*from www. j a v  a 2 s  . c  om*/
    return false;
}

From source file:com.facebook.buck.macho.MachoHeaderUtils.java

public static MachoHeader create32BitFromBuffer(ByteBuffer buffer) {
    return MachoHeader.of(UnsignedInteger.fromIntBits(buffer.getInt()), buffer.getInt(), buffer.getInt(),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()),
            Optional.empty());//from  w  w w.  j  a  va 2  s  .co m
}

From source file:com.facebook.buck.macho.MachoMagicInfoUtils.java

/**
 * Reads 4 bytes from the given byte buffer from position 0 and produces the MachoMagicInfo object
 * which describes basic information about Mach Object file.
 * @param buffer Byte Buffer which holds bytes for the mach header magic number.
 * @return MachoMagicInfo object.//w  w w. j a  v  a  2  s  .com
 * @throws IOException
 */
public static MachoMagicInfo getMachMagicInfo(ByteBuffer buffer) {
    ByteOrder order = buffer.order();
    UnsignedInteger magic = UnsignedInteger.fromIntBits(buffer.order(ByteOrder.BIG_ENDIAN).getInt());
    buffer.order(order);
    return new MachoMagicInfo(magic);
}

From source file:com.facebook.buck.macho.SymTabCommandUtils.java

public static SymTabCommand createFromBuffer(ByteBuffer buffer) {
    return SymTabCommand.of(LoadCommandCommonFieldsUtils.createFromBuffer(buffer),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()));
}

From source file:com.facebook.buck.macho.NlistUtils.java

/**
 * Reads Nlist entry for the given architecture from the buffer at the current position.
 * @param buffer ByteBuffer with data, must be positioned properly.
 * @param is64Bit Indicator if architecture is 32 or 64 bits.
 * @return Nlist entry//from w w w . ja v a 2  s  .com
 */
public static Nlist createFromBuffer(ByteBuffer buffer, boolean is64Bit) {
    return Nlist.of(buffer.position(), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.get() & 0xFF), UnsignedInteger.fromIntBits(buffer.get() & 0xFF),
            UnsignedInteger.fromIntBits(buffer.getShort() & 0xFFFF),
            UnsignedLong.fromLongBits(is64Bit ? buffer.getLong() : buffer.getInt() & 0xFFFFFFFFL));
}

From source file:com.facebook.buck.macho.MachoHeaderUtils.java

public static MachoHeader create64BitFromBuffer(ByteBuffer buffer) {
    return MachoHeader.of(UnsignedInteger.fromIntBits(buffer.getInt()), buffer.getInt(), buffer.getInt(),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()),
            UnsignedInteger.fromIntBits(buffer.getInt()), UnsignedInteger.fromIntBits(buffer.getInt()),
            Optional.of(UnsignedInteger.fromIntBits(buffer.getInt())));
}