@Override public byte readByte() throws IOException { try { return input.readByte(); } catch (KryoException e) { throw new IOException(e); } }
@Override public byte readByte() throws IOException { try { return input.readByte(); } catch (KryoException e) { throw new IOException(e); } }
private static Object readPayload(Kryo kryo, Input in) { byte payloadTypeId = in.readByte(); if (PayloadType.OBJECT_ARRAY.id == payloadTypeId) { return kryo.readObject(in, Object[].class); } if (PayloadType.NULL.id == payloadTypeId) { return null; } return kryo.readClassAndObject(in); }
private static Map<String, Object> readHeaders(Kryo kryo, Input in) { int headers = in.readInt(); if (headers == 0) { return Collections.emptyMap(); } Map<String, Object> payload = new HashMap<>(headers); for (int i = 0; i < headers; i++) { String key = in.readString(); byte valueTypeId = in.readByte(); if (valueTypeId == ValueType.STRING.id) { payload.put(key, in.readString()); } else if (valueTypeId == ValueType.INT.id) { payload.put(key, in.readInt()); } else { payload.put(key, kryo.readClassAndObject(in)); } } return payload; }
private static Object readObjectId(Kryo kryo, Input in) { byte valueTypeIdForObjectId = in.readByte(); if (valueTypeIdForObjectId == ValueType.STRING.id) { return in.readString(); } else if (valueTypeIdForObjectId == ValueType.INT.id) { return in.readInt(); } else { return kryo.readClassAndObject(in); } }
public void read (Kryo kryo, Input input) { objectID = input.readInt(true); int methodClassID = input.readInt(true); Class methodClass = kryo.getRegistration(methodClassID).getType(); byte methodIndex = input.readByte(); try { cachedMethod = getMethods(kryo, methodClass)[methodIndex]; } catch (IndexOutOfBoundsException ex) { throw new KryoException("Invalid method index " + methodIndex + " for class: " + methodClass.getName()); } Serializer[] serializers = cachedMethod.serializers; Class[] parameterTypes = cachedMethod.method.getParameterTypes(); Object[] args = new Object[serializers.length]; this.args = args; for (int i = 0, n = args.length; i < n; i++) { Serializer serializer = serializers[i]; if (serializer != null) args[i] = kryo.readObjectOrNull(input, parameterTypes[i], serializer); else args[i] = kryo.readClassAndObject(input); } responseData = input.readByte(); } }
@Override public byte readByte() { return unshadedInput.readByte(); }
@Override public Message deserializeMessage(BasicRuntime basicRuntime, final byte[] payload) throws Exception { return inputPool.run(in -> { in.setInputStream(new ByteArrayInputStream(payload)); return kryoPool.run(kryo -> { final Message message = new Message(); message.setMessageType(in.readByte()); message.setMessageId(in.readInt()); message.setReferenceAddress(readNodeAddress(in)); message.setInterfaceId(in.readInt()); message.setMethodId(in.readInt()); message.setObjectId(readObjectId(kryo, in)); message.setHeaders(readHeaders(kryo, in)); message.setFromNode(readNodeAddress(in)); message.setPayload(readPayload(kryo, in)); return message; }); }, DEFAULT_BUFFER_SIZE); }
public byte readByte() throws IOException { try { return input.readByte(); } catch (KryoException e) { throw new IOException(e); } }
public byte readByte() throws EOFException { try { return input.readByte(); } catch (KryoException e) { throw maybeEndOfStream(e); } }
public YearMonth read (Kryo kryo, Input in, Class<YearMonth> type) { int year = in.readInt(true); byte month = in.readByte(); return YearMonth.of(year, month); } }
public YearMonth read (Kryo kryo, Input in, Class<YearMonth> type) { int year = in.readInt(true); byte month = in.readByte(); return YearMonth.of(year, month); } }
public void read (Input input, Object object) { try { field.setByte(object, input.readByte()); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } }
public void read (Input input, Object object) { try { field.setByte(object, input.readByte()); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } }
private Object decodeAsKryo(ByteBuf frame) { Kryo kryo = kryoContextHolder.get().getKryo(); Input input = new Input(new ByteBufInputStream(frame)); input.readByte(); // skip first byte Object object = kryo.readClassAndObject(input); return object; }
static ZoneOffset read (Input in) { int offsetByte = in.readByte(); return (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900)); } }
static ZoneOffset read(Input in) { int offsetByte = in.readByte(); return (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900)); } }