Codota Logo
DataUtils.readVarInt
Code IndexAdd Codota to your IDE (free)

How to use
readVarInt
method
in
org.h2.mvstore.DataUtils

Best Java code snippets using org.h2.mvstore.DataUtils.readVarInt (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

private static int readVarInt(ByteBuffer buff) {
  return DataUtils.readVarInt(buff);
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  switch (tag) {
  case TYPE_INT:
    return DataUtils.readVarInt(buff);
  case TAG_INTEGER_NEGATIVE:
    return -DataUtils.readVarInt(buff);
  case TAG_INTEGER_FIXED:
    return buff.getInt();
  }
  return tag - TAG_INTEGER_0_15;
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  int len;
  if (tag == TYPE_STRING) {
    len = DataUtils.readVarInt(buff);
  } else {
    len = tag - TAG_STRING_0_15;
  }
  return DataUtils.readString(buff, len);
}
origin: com.h2database/h2

@Override
public String read(ByteBuffer buff) {
  int len = DataUtils.readVarInt(buff);
  return DataUtils.readString(buff, len);
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  switch (tag) {
  case TAG_FLOAT_0:
    return 0f;
  case TAG_FLOAT_1:
    return 1f;
  case TAG_FLOAT_FIXED:
    return buff.getFloat();
  }
  return Float.intBitsToFloat(Integer.reverse(DataUtils
      .readVarInt(buff)));
}
origin: com.h2database/h2

/**
 * Check whether the id itself contains all the data. This operation does
 * not cause any reads in the map.
 *
 * @param id the id
 * @return if the id contains the data
 */
public boolean isInPlace(byte[] id) {
  ByteBuffer idBuffer = ByteBuffer.wrap(id);
  while (idBuffer.hasRemaining()) {
    if (idBuffer.get() != 0) {
      return false;
    }
    int len = DataUtils.readVarInt(idBuffer);
    idBuffer.position(idBuffer.position() + len);
  }
  return true;
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  switch (tag) {
  case TAG_BIG_DECIMAL_0:
    return BigDecimal.ZERO;
  case TAG_BIG_DECIMAL_1:
    return BigDecimal.ONE;
  case TAG_BIG_DECIMAL_SMALL:
    return BigDecimal.valueOf(DataUtils.readVarLong(buff));
  case TAG_BIG_DECIMAL_SMALL_SCALED:
    int scale = DataUtils.readVarInt(buff);
    return BigDecimal.valueOf(DataUtils.readVarLong(buff), scale);
  }
  int scale = DataUtils.readVarInt(buff);
  int len = DataUtils.readVarInt(buff);
  byte[] bytes = Utils.newBytes(len);
  buff.get(bytes);
  BigInteger b = new BigInteger(bytes);
  return new BigDecimal(b, scale);
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  int len = DataUtils.readVarInt(buff);
  byte[] data = Utils.newBytes(len);
  int size = data.length * 2;
  // adjust the average size
  // using an exponential moving average
  averageSize = (size + 15 * averageSize) / 16;
  buff.get(data);
  return deserialize(data);
}
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff, int tag) {
  switch (tag) {
  case TAG_BIG_INTEGER_0:
    return BigInteger.ZERO;
  case TAG_BIG_INTEGER_1:
    return BigInteger.ONE;
  case TAG_BIG_INTEGER_SMALL:
    return BigInteger.valueOf(DataUtils.readVarLong(buff));
  }
  int len = DataUtils.readVarInt(buff);
  byte[] bytes = Utils.newBytes(len);
  buff.get(bytes);
  return new BigInteger(bytes);
}
origin: com.h2database/h2

case 0:
  len = DataUtils.readVarInt(idBuffer);
  idBuffer.position(idBuffer.position() + len);
  buff.append("data len=").append(len);
case 1:
  len = DataUtils.readVarInt(idBuffer);
  length += len;
  block = DataUtils.readVarLong(idBuffer);
case 2:
  len = DataUtils.readVarInt(idBuffer);
  length += DataUtils.readVarLong(idBuffer);
  block = DataUtils.readVarLong(idBuffer);
origin: com.h2database/h2

case 0:
  int len = DataUtils.readVarInt(idBuffer);
  idBuffer.position(idBuffer.position() + len);
  length += len;
case 1:
  length += DataUtils.readVarInt(idBuffer);
  DataUtils.readVarLong(idBuffer);
  break;
origin: com.h2database/h2

case 0:
  int len = DataUtils.readVarInt(idBuffer);
  idBuffer.position(idBuffer.position() + len);
  break;
case 1:
  DataUtils.readVarInt(idBuffer);
  long k = DataUtils.readVarLong(idBuffer);
  map.remove(k);
origin: com.h2database/h2

case 0:
  int len = DataUtils.readVarInt(idBuffer);
  idBuffer.position(idBuffer.position() + len);
  break;
case 1:
  DataUtils.readVarInt(idBuffer);
  long k = DataUtils.readVarLong(idBuffer);
  maxKey = Math.max(maxKey, k);
origin: com.h2database/h2

switch (idBuffer.get()) {
case 0: {
  int len = DataUtils.readVarInt(idBuffer);
  if (skip >= len) {
    skip -= len;
  int len = DataUtils.readVarInt(idBuffer);
  long key = DataUtils.readVarLong(idBuffer);
  if (skip >= len) {
origin: com.h2database/h2

@Override
public Object read(ByteBuffer buff) {
  int flags = DataUtils.readVarInt(buff);
  if (flags == -1) {
    long id = DataUtils.readVarLong(buff);
    return new SpatialKey(id);
  }
  float[] minMax = new float[dimensions * 2];
  for (int i = 0; i < dimensions; i++) {
    float min = buff.getFloat();
    float max;
    if ((flags & (1 << i)) != 0) {
      max = min;
    } else {
      max = buff.getFloat();
    }
    minMax[i + i] = min;
    minMax[i + i + 1] = max;
  }
  long id = DataUtils.readVarLong(buff);
  return new SpatialKey(id, minMax);
}
origin: com.h2database/h2

  clazz = COMMON_CLASSES[ct];
int len = DataUtils.readVarInt(buff);
try {
  obj = Array.newInstance(clazz, len);
origin: com.h2database/h2

int mapId = DataUtils.readVarInt(chunk);
int entries = DataUtils.readVarInt(chunk);
int type = chunk.get();
boolean compressed = (type & DataUtils.PAGE_COMPRESSED) != 0;
        DataUtils.PAGE_COMPRESSED_HIGH);
    Compressor compressor = getCompressor(fast);
    int lenAdd = DataUtils.readVarInt(chunk);
    int compLen = pageSize + start - chunk.position();
    byte[] comp = Utils.newBytes(compLen);
origin: com.h2database/h2

int m = DataUtils.readVarInt(buff);
if (m != mapId) {
  throw DataUtils.newIllegalStateException(
      chunkId, checkTest, check);
int len = DataUtils.readVarInt(buff);
int type = buff.get();
boolean node = (type & 1) == DataUtils.PAGE_TYPE_NODE;
origin: com.h2database/h2

int mapId = DataUtils.readVarInt(buff);
if (mapId != map.getId()) {
  throw DataUtils.newIllegalStateException(
      chunkId, checkTest, check);
int len = DataUtils.readVarInt(buff);
keys = new Object[len];
int type = buff.get();
    compressor = map.getStore().getCompressorFast();
  int lenAdd = DataUtils.readVarInt(buff);
  int compLen = pageLength + start - buff.position();
  byte[] comp = Utils.newBytes(compLen);
origin: com.h2database/h2-mvstore

@Override
public Object read(ByteBuffer buff, int tag) {
  switch (tag) {
  case TYPE_INT:
    return DataUtils.readVarInt(buff);
  case TAG_INTEGER_NEGATIVE:
    return -DataUtils.readVarInt(buff);
  case TAG_INTEGER_FIXED:
    return buff.getInt();
  }
  return tag - TAG_INTEGER_0_15;
}
org.h2.mvstoreDataUtilsreadVarInt

Javadoc

Read a variable size int.

Popular methods of DataUtils

  • appendMap
    Append a map to the string builder, sorted by key.
  • checkArgument
    Throw an IllegalArgumentException if the argument is invalid.
  • copyExcept
    Copy the elements of an array, and remove one element.
  • copyWithGap
    Copy the elements of an array, with a gap.
  • encodeLength
    Convert the length to a length code 0..31. 31 means more than 1 MB.
  • formatMessage
    Format an error message.
  • getCheckValue
    Calculate a check value for the given integer. A check value is mean to verify the data is consisten
  • getErrorCode
    Get the error code from an exception message.
  • getFletcher32
    Calculate the Fletcher32 checksum.
  • getPageChunkId
    Get the chunk id from the position.
  • getPageMaxLength
    Get the maximum length for the given code. For the code 31, PAGE_LARGE is returned.
  • getPageOffset
    Get the offset from the position.
  • getPageMaxLength,
  • getPageOffset,
  • getPagePos,
  • getPageType,
  • getVarIntLen,
  • initCause,
  • newIllegalArgumentException,
  • newIllegalStateException,
  • newUnsupportedOperationException

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • notifyDataSetChanged (ArrayAdapter)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now