com.esotericsoftware.kryo.io.Input.read()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中com.esotericsoftware.kryo.io.Input.read()方法的一些代码示例,展示了Input.read()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.read()方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Input
类名称:Input
方法名:read

Input.read介绍

[英]Reads a single byte as an int from 0 to 255, or -1 if there are no more bytes are available.
[中]将单个字节读取为0到255之间的整数,如果没有更多字节可用,则读取-1。

代码示例

代码示例来源:origin: apache/kylin

@Override
  public PercentileCounter read(Kryo kryo, Input input, Class type) {
    double compression = input.readDouble();
    double quantileRatio = input.readDouble();
    int length = input.readInt();
    byte[] buffer = new byte[length];
    input.read(buffer);
    PercentileCounter counter = new PercentileCounter(compression, quantileRatio);
    counter.readRegisters(ByteBuffer.wrap(buffer));
    return counter;
  }
}

代码示例来源:origin: io.snappydata/snappy-spark-unsafe

@Override
public void read(Kryo kryo, Input in) {
 this.offset = BYTE_ARRAY_OFFSET;
 this.numBytes = in.readInt();
 this.base = new byte[numBytes];
 in.read((byte[]) base);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Reads bytes.length bytes or less and writes them to the specified byte[], starting at 0, and returns the number of bytes
 * read. */
public int read (byte[] bytes) throws KryoException {
  return read(bytes, 0, bytes.length);
}

代码示例来源:origin: org.apache.spark/spark-catalyst_2.10

@Override
 public void read(Kryo kryo, Input in) {
  this.baseOffset = BYTE_ARRAY_OFFSET;
  this.sizeInBytes = in.readInt();
  this.numFields = in.readInt();
  this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields);
  this.baseObject = new byte[sizeInBytes];
  in.read((byte[]) baseObject);
 }
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Reads bytes.length bytes or less and writes them to the specified byte[], starting at 0, and returns the number of bytes
 * read. */
public int read (byte[] bytes) throws KryoException {
  return read(bytes, 0, bytes.length);
}

代码示例来源:origin: org.apache.spark/spark-catalyst_2.11

@Override
 public void read(Kryo kryo, Input in) {
  this.baseOffset = BYTE_ARRAY_OFFSET;
  this.sizeInBytes = in.readInt();
  this.numFields = in.readInt();
  this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields);
  this.baseObject = new byte[sizeInBytes];
  in.read((byte[]) baseObject);
 }
}

代码示例来源:origin: co.paralleluniverse/quasar-core

@Override
public int read() throws IOException {
  return in.read();
}

代码示例来源:origin: org.apache.spark/spark-catalyst

@Override
 public void read(Kryo kryo, Input in) {
  this.baseOffset = BYTE_ARRAY_OFFSET;
  this.sizeInBytes = in.readInt();
  this.numFields = in.readInt();
  this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields);
  this.baseObject = new byte[sizeInBytes];
  in.read((byte[]) baseObject);
 }
}

代码示例来源:origin: co.paralleluniverse/quasar-core

@Override
public int read(byte[] b, int off, int len) throws IOException {
  return in.read(b, off, len);
}

代码示例来源:origin: org.onosproject/onos-core-serializers

@Override
  public ImmutableByteSequence read(Kryo kryo, Input input, Class<ImmutableByteSequence> type) {
    int length = input.readInt();
    byte[] data = new byte[length];
    int bytesRead = input.read(data);
    if (bytesRead != length) {
      throw new IllegalStateException("Byte sequence serializer read expected " + length +
          " but got " + bytesRead);
    }
    return ImmutableByteSequence.copyFrom(data);
  }
}

代码示例来源:origin: co.paralleluniverse/galaxy

@Override
public int read() throws IOException {
  return in.read();
}

代码示例来源:origin: svn2github/kryo

/** Reads bytes.length bytes or less and writes them to the specified byte[], starting at 0, and returns the number of bytes
 * read. */
public int read (byte[] bytes) throws KryoException {
  return read(bytes, 0, bytes.length);
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

/** Reads bytes.length bytes or less and writes them to the specified byte[], starting at 0, and returns the number of bytes
 * read. */
public int read (byte[] bytes) throws KryoException {
  return read(bytes, 0, bytes.length);
}

代码示例来源:origin: DataSystemsLab/GeoSpark

private static ByteBuffer toByteBuffer(Input input, int numBytes)
  {
    byte[] bytes = new byte[numBytes];
    input.read(bytes);
    return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
  }
}

代码示例来源:origin: nielsbasjes/yauaa

@Override
public MatcherList read(Kryo kryo, Input input, Class<MatcherList> type) {
  MatcherList matcherList = new MatcherList();
  matcherList.maxSize = input.read();
  // Note: The matches list is always empty after deserialization.
  matcherList.initialize();
  return matcherList;
}

代码示例来源:origin: nielsbasjes/yauaa

@Override
public MatchesList read(Kryo kryo, Input input, Class<MatchesList> type) {
  MatchesList matchesList = new MatchesList();
  matchesList.maxSize = input.read();
  // Note: The matches list is always empty after deserialization.
  matchesList.initialize();
  return matchesList;
}

代码示例来源:origin: NationalSecurityAgency/datawave

@Override
public void read(Kryo kryo, Input input) {
  readMetadata(kryo, input);
  int wkbLength = input.read();
  byte[] wellKnownBinary = new byte[wkbLength];
  input.read(wellKnownBinary);
  try {
    geometry = new WKBReader().read(wellKnownBinary);
  } catch (ParseException e) {
    throw new IllegalArgumentException("Cannot parse the geometry", e);
  }
}

代码示例来源:origin: com.esotericsoftware/kryo

public Class read (Kryo kryo, Input input, Class<Class> type) {
    Registration registration = kryo.readClass(input);
    int isPrimitive = input.read();
    Class typ = registration != null ? registration.getType() : null;
    if (typ == null || !typ.isPrimitive()) return typ;
    return (isPrimitive == 1) ? typ : getWrapperClass(typ);
  }
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

public Class read (Kryo kryo, Input input, Class<Class> type) {
    Registration registration = kryo.readClass(input);
    int isPrimitive = input.read();
    Class typ = registration != null ? registration.getType() : null;
    if (typ == null || !typ.isPrimitive()) return typ;
    return (isPrimitive == 1) ? typ : getWrapperClass(typ);
  }
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

public Class read (Kryo kryo, Input input, Class<Class> type) {
    Registration registration = kryo.readClass(input);
    int isPrimitive = input.read();
    Class typ = registration != null ? registration.getType() : null;
    if (typ == null || !typ.isPrimitive()) return typ;
    return (isPrimitive == 1) ? typ : getWrapperClass(typ);
  }
}

相关文章

微信公众号

最新文章

更多