List of usage examples for com.google.common.primitives UnsignedInteger equals
@Override
public boolean equals(@Nullable Object obj)
From source file:com.facebook.buck.macho.FatHeaderUtils.java
public static boolean isFatHeaderMagic(UnsignedInteger magic) { return magic.equals(FatHeader.FAT_MAGIC) || magic.equals(FatHeader.FAT_CIGAM); }
From source file:com.facebook.buck.macho.FatHeaderUtils.java
public static boolean isLittleEndian(UnsignedInteger magic) { return magic.equals(FatHeader.FAT_CIGAM); }
From source file:com.facebook.buck.macho.MachoHeaderUtils.java
/** * Reads the Mach Header from the given buffer from current position. * @param buffer Buffer that holds the data of the mach header * @return MachoHeader for 32 or 64 bit Mach object. *//*from w ww. j a v a 2 s . c o m*/ public static MachoHeader createFromBuffer(ByteBuffer buffer) { int position = buffer.position(); UnsignedInteger magic = UnsignedInteger.fromIntBits(buffer.getInt()); buffer.position(position); Preconditions.checkArgument(magic.equals(MachoHeader.MH_MAGIC) || magic.equals(MachoHeader.MH_MAGIC_64)); if (magic.equals(MachoHeader.MH_MAGIC_64)) { return create64BitFromBuffer(buffer); } else { return create32BitFromBuffer(buffer); } }
From source file:com.facebook.buck.macho.LoadCommandUtils.java
/** * This is a kind of umbrella method that returns you LoadCommand object depending on the contents * of the given bytes array.// w w w. j ava 2 s . c o m * @param buffer Buffer which contains at least values for the LoadCommand fields, * positioned at the first byte of the command (cmd field) * @return LoadCommandCommonFields that is suitable to handle the given bytes array. */ public static LoadCommand createLoadCommandFromBuffer(ByteBuffer buffer, NulTerminatedCharsetDecoder nulTerminatedCharsetDecoder) { int position = buffer.position(); UnsignedInteger cmd = UnsignedInteger.fromIntBits(buffer.getInt()); buffer.position(position); if (SegmentCommand.VALID_CMD_VALUES.contains(cmd)) { return SegmentCommandUtils.createFromBuffer(buffer, nulTerminatedCharsetDecoder); } else if (cmd.equals(SymTabCommand.LC_SYMTAB)) { return SymTabCommandUtils.createFromBuffer(buffer); } else if (cmd.equals(UUIDCommand.LC_UUID)) { return UUIDCommandUtils.createFromBuffer(buffer); } else if (LinkEditDataCommand.VALID_CMD_VALUES.contains(cmd)) { return LinkEditDataCommandUtils.createFromBuffer(buffer); } else { return UnknownCommandUtils.createFromBuffer(buffer); } }
From source file:org.opendaylight.protocol.bgp.mode.impl.base.OffsetMap.java
private int indexOfRouterId(final UnsignedInteger key) { for (int i = 0; i < this.routeKeys.length; i++) { if (key.equals(this.routeKeys[i])) { return i; }/*www . ja v a2 s . co m*/ } return -1; }
From source file:org.opendaylight.protocol.bgp.rib.impl.OffsetMap.java
private int indexOfRouterId(final UnsignedInteger routerId) { final int startIndex = 0; for (int i = startIndex; i < this.routerIds.length; i++) { if (routerId.equals(this.routerIds[i])) { return i; }/*from w w w . j a v a 2s . com*/ } return -1; }