com.google.bitcoin.core
Class VarInt

java.lang.Object
  extended by com.google.bitcoin.core.VarInt

public class VarInt
extends Object

A variable-length encoded integer using Satoshis encoding.


Field Summary
 long value
           
 
Constructor Summary
VarInt(byte[] buf, int offset)
           
VarInt(long value)
           
 
Method Summary
 byte[] encode()
           
 int getOriginalSizeInBytes()
          Gets the number of bytes used to encode this originally if deserialized from a byte array.
 int getSizeInBytes()
          Gets the minimum encoded size of the value stored in this VarInt
static int sizeOf(int value)
          Gets the minimum encoded size of the given value.
static int sizeOf(long value)
          Gets the minimum encoded size of the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public final long value
Constructor Detail

VarInt

public VarInt(long value)

VarInt

public VarInt(byte[] buf,
              int offset)
Method Detail

getOriginalSizeInBytes

public int getOriginalSizeInBytes()
Gets the number of bytes used to encode this originally if deserialized from a byte array. Otherwise returns the minimum encoded size


getSizeInBytes

public int getSizeInBytes()
Gets the minimum encoded size of the value stored in this VarInt


sizeOf

public static int sizeOf(int value)
Gets the minimum encoded size of the given value.


sizeOf

public static int sizeOf(long value)
Gets the minimum encoded size of the given value.


encode

public byte[] encode()


Copyright © 2014. All rights reserved.