Example usage for com.google.common.primitives UnsignedLong intValue

List of usage examples for com.google.common.primitives UnsignedLong intValue

Introduction

In this page you can find the example usage for com.google.common.primitives UnsignedLong intValue.

Prototype

@Override
public int intValue() 

Source Link

Document

Returns the value of this UnsignedLong as an int .

Usage

From source file:com.dianping.puma.utils.PacketUtils.java

public static String readLengthCodedString(ByteBuffer buf) throws IOException {
    final UnsignedLong length = readLengthCodedUnsignedLong(buf);
    return length == null ? null : readFixedLengthString(buf, length.intValue());
}

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

private void processLinkeditSegmentCommand(SegmentCommand original,
        Optional<LinkEditDataCommand> updatedCodeSignatureCommand) {
    SymTabCommand symTabCommand = getSymTabCommand();
    int fileSize = symTabCommand.getStroff().intValue() + symTabCommand.getStrsize().intValue();
    if (updatedCodeSignatureCommand.isPresent()) {
        LinkEditDataCommand codeSignCommand = updatedCodeSignatureCommand.get();
        /**// ww w .j a  v a 2s  .c  o  m
         * If code signature is present, append it's size plus size of the gap between string table
         * and code signature itself that can be caused by the aligning of the code signature.
         */
        fileSize = codeSignCommand.getDataoff().intValue() + codeSignCommand.getDatasize().intValue();
    }

    fileSize -= original.getFileoff().intValue();

    UnsignedLong updatedFileSize = UnsignedLong.valueOf(fileSize);
    UnsignedLong updatedVmSize = UnsignedLong
            .fromLongBits(SegmentCommandUtils.alignValue(updatedFileSize.intValue()));
    SegmentCommand updated = original.withFilesize(updatedFileSize).withVmsize(updatedVmSize);
    SegmentCommandUtils.updateSegmentCommand(buffer, original, updated);
}