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

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

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

Input.readBytes介绍

[英]Reads the specified number of bytes into a new byte[].
[中]将指定的字节数读入新字节[]。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public byte[] readBytes() throws IOException {
  try {
    int len = input.readInt();
    if (len < 0) {
      return null;
    } else if (len == 0) {
      return new byte[]{};
    } else {
      return input.readBytes(len);
    }
  } catch (KryoException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public byte[] readBytes() throws IOException {
  try {
    int len = input.readInt();
    if (len < 0) {
      return null;
    } else if (len == 0) {
      return new byte[]{};
    } else {
      return input.readBytes(len);
    }
  } catch (KryoException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: alibaba/jstorm

@Override
  public ByteBuffer read(Kryo kryo, Input input, Class<ByteBuffer> type) {
    int len = input.readInt();
    return ByteBuffer.wrap(input.readBytes(len));
  }
}

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

@Override
  public Object read(Kryo kryo, Input input, Class c) {
    int len = input.readInt();
    byte[] ser = new byte[len];
    input.readBytes(ser);
    ByteArrayInputStream bis = new ByteArrayInputStream(ser);
    try {
      ObjectInputStream ois = new ObjectInputStream(bis);
      return ois.readObject();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

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

@Override
  public PyLong read(Kryo kryo, Input input, Class<PyLong> type) {
    int length = input.readShort();
    return new PyLong(new BigInteger(input.readBytes(length)));
  }
}

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

public BytesWritable read(Kryo kryo, Input input, Class<BytesWritable> type) {
 int len = input.readVarInt(true);
 byte[] bytes = new byte[len];
 input.readBytes(bytes);
 return new BytesWritable(bytes);
}

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

private BytesWritable readValue(Input input) {
 return new BytesWritable(input.readBytes(input.readInt()));
}

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

private BytesWritable readValue(Input input) {
 return new BytesWritable(input.readBytes(input.readInt()));
}

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

@Override
  public TupleImpl read(Kryo kryo, Input input, Class<TupleImpl> type) {
    int length = input.readInt();
    byte[] bytes = input.readBytes(length);
    return tupleDeserializer.deserialize(bytes);
  }
}

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

public HiveKey read(Kryo kryo, Input input, Class<HiveKey> type) {
  int len = input.readVarInt(true);
  byte[] bytes = new byte[len];
  input.readBytes(bytes);
  return new HiveKey(bytes);
 }
}

代码示例来源:origin: alibaba/jstorm

@Override
  public Object read(Kryo kryo, Input input, Class c) {
    int len = input.readInt();
    byte[] ser = new byte[len];
    input.readBytes(ser);
    ByteArrayInputStream bis = new ByteArrayInputStream(ser);
    try {
      ClassLoaderObjectInputStream ois = new ClassLoaderObjectInputStream(kryo.getClassLoader(), bis);
      return ois.readObject();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

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

public HiveKey read(Kryo kryo, Input input, Class<HiveKey> type) {
  int len = input.readVarInt(true);
  byte[] bytes = new byte[len];
  input.readBytes(bytes);
  return new HiveKey(bytes, input.readVarInt(false));
 }
}

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

public PyObject read(Kryo kryo, Input input, Class<PyObject> type) {
    int len = input.readInt();
    byte[] serPo = input.readBytes(len);
    try {
      return (PyObject) SerializationUtils.deserializeObject(serPo);
    } catch (IOException e) {
      throw new KryoException("Failed to deserialize object.", e);
    } catch (ClassNotFoundException e) {
      // this should only be possible if jython isn't on the class-path
      throw new KryoException("Failed to deserialize object.", e);
    }
  }
}

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

@Override
  public TestRecord read(Kryo kryo, Input input, Class<TestRecord> type) {
    int length = input.readInt();
    byte[] buffer = input.readBytes(length);
    return new TestRecord(buffer);
  }
}

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

private HiveKey readHiveKey(Input input) {
 HiveKey hiveKey = new HiveKey(input.readBytes(input.readInt()), input.readInt());
 hiveKey.setDistKeyLength(input.readInt());
 return hiveKey;
}

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

private HiveKey readHiveKey(Input input) {
 HiveKey hiveKey = new HiveKey(
  input.readBytes(input.readInt()), input.readInt());
 hiveKey.setDistKeyLength(input.readInt());
 return hiveKey;
}

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

@Override
public byte[] readBytes(final int size) {
  return unshadedInput.readBytes(size);
}

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

@Override
 public void read(Kryo kryo, Input input) {
  int numVariableMappings = input.readShort();
  variableMappings = new ArrayList<>(numVariableMappings);
  for(int i = 0;i < numVariableMappings;++i) {
   int size = input.readInt();
   if(size > 0) {
    byte[] bytes = input.readBytes(size);
    Map m = SerDeUtils.fromBytes(bytes, Map.class);
    variableMappings.add(m);
   }
  }
 }
}

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

/** Reads the specified number of bytes into a new byte[]. */
public byte[] readBytes (int length) throws KryoException {
  byte[] bytes = new byte[length];
  readBytes(bytes, 0, length);
  return bytes;
}

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

@Override
 public void read(Kryo kryo, Input input) {
  int digestSize = input.readInt();
  byte[] digestBytes = input.readBytes(digestSize);
  ByteBuffer digestBuff = ByteBuffer.wrap(digestBytes);
  digest = AVLTreeDigest.fromBytes(digestBuff);
  n = input.readLong();
  sum = input.readDouble();
  sumOfSquares = input.readDouble();
  sumOfLogs = input.readDouble();
  min = input.readDouble();
  max = input.readDouble();
  M1 = input.readDouble();
  M2 = input.readDouble();
  M3 = input.readDouble();
  M4 = input.readDouble();
 }
}

相关文章

微信公众号

最新文章

更多