本文整理了Java中com.esotericsoftware.kryo.io.Output.writeInt()
方法的一些代码示例,展示了Output.writeInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.writeInt()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Output
类名称:Output
方法名:writeInt
[英]Writes a 4 byte int. Uses BIG_ENDIAN byte order.
[中]写入一个4字节的整数。使用BIG_ENDIAN字节顺序。
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeInt(int v) throws IOException {
output.writeInt(v);
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeInt(int v) throws IOException {
output.writeInt(v);
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {
if (v == null) {
output.writeInt(-1);
} else {
output.writeInt(len);
output.write(v, off, len);
}
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {
if (v == null) {
output.writeInt(-1);
} else {
output.writeInt(len);
output.write(v, off, len);
}
}
代码示例来源:origin: alibaba/jstorm
private void serializeIntegers(List<Object> values, Output out) {
out.writeInt(values.size(), true);
for (Object o : values) {
Integer i = (Integer) o;
out.writeInt(i, true);
}
}
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeBytes(byte[] v) throws IOException {
if (v == null) {
output.writeInt(-1);
} else {
writeBytes(v, 0, v.length);
}
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeBytes(byte[] v) throws IOException {
if (v == null) {
output.writeInt(-1);
} else {
writeBytes(v, 0, v.length);
}
}
代码示例来源:origin: apache/flink
@Override
public void write(Kryo kryo, Output output, PyInteger object) {
output.writeInt(object.getValue());
}
代码示例来源:origin: alibaba/jstorm
@Override
public void write(Kryo kryo, Output output, ByteBuffer object) {
output.writeInt(object.array().length);
output.write(object.array());
}
代码示例来源:origin: apache/storm
@Override
public void write(Kryo kryo, Output output, Object object) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(object);
oos.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
byte[] ser = bos.toByteArray();
output.writeInt(ser.length);
output.writeBytes(ser);
}
代码示例来源:origin: alibaba/jstorm
private void serializeStrings(List<Object> values, Output out) {
out.writeInt(values.size(), true);
for (Object o : values) {
String str = (String) o;
out.writeString(str);
}
}
代码示例来源:origin: apache/storm
public void serialize(Output out) throws IOException {
out.writeInt(_anchorsToIds.size(), true);
for (Entry<Long, Long> anchorToId : _anchorsToIds.entrySet()) {
out.writeLong(anchorToId.getKey());
out.writeLong(anchorToId.getValue());
}
}
}
代码示例来源:origin: apache/flink
@Override
public void write(Kryo kryo, Output output, LocalDate localDate) {
output.writeInt(localDate.getYear());
output.writeInt(localDate.getMonthOfYear());
output.writeInt(localDate.getDayOfMonth());
final Chronology chronology = localDate.getChronology();
if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
throw new RuntimeException("Unsupported chronology: " + chronology);
}
}
代码示例来源:origin: alibaba/jstorm
public void serialize(Output out) throws IOException {
out.writeInt(_anchorsToIds.size(), true);
for (Entry<Long, Long> anchorToId : _anchorsToIds.entrySet()) {
out.writeLong(anchorToId.getKey());
out.writeLong(anchorToId.getValue());
}
}
代码示例来源:origin: apache/storm
@Override
public void write(Kryo kryo, Output output, TupleImpl tuple) {
byte[] bytes = tupleSerializer.serialize(tuple);
output.writeInt(bytes.length);
output.write(bytes);
}
代码示例来源:origin: apache/flink
@Override
public void write(Kryo kryo, Output output, LocalTime object) {
final int time = object.getMillisOfDay();
output.writeInt(time, true);
final Chronology chronology = object.getChronology();
if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
throw new RuntimeException("Unsupported chronology: " + chronology);
}
}
代码示例来源:origin: apache/flink
@Override
public void write(Kryo kryo, Output output, LocalDate object) {
output.writeInt(object.getYear());
output.writeInt(object.getMonthOfYear());
output.writeInt(object.getDayOfMonth());
}
代码示例来源:origin: apache/flink
@Override
public void write(Kryo kryo, Output output, TestRecord object) {
output.writeInt(object.buffer.length);
output.write(object.buffer);
}
代码示例来源:origin: apache/flink
public void write(Kryo kryo, Output output, PyObject po) {
try {
byte[] serPo = SerializationUtils.serializeObject(po);
output.writeInt(serPo.length);
output.write(serPo);
} catch (IOException e) {
throw new KryoException("Failed to serialize object.", e);
}
}
代码示例来源:origin: apache/storm
public byte[] serialize(Tuple tuple) {
try {
_kryoOut.clear();
_kryoOut.writeInt(tuple.getSourceTask(), true);
_kryoOut.writeInt(_ids.getStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId()), true);
tuple.getMessageId().serialize(_kryoOut);
_kryo.serializeInto(tuple.getValues(), _kryoOut);
return _kryoOut.toBytes();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!