Tabnine Logo
DataUtils.readVarInt
Code IndexAdd Tabnine 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)

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

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now