public O deserializeResponse(ByteBufOrStream message) throws IOException { InputStream messageStream = message.stream(); if (message.buf() != null) { try { switch (responseType) { case PROTOBUF: final PrototypeMarshaller<O> marshaller = (PrototypeMarshaller<O>) method.getResponseMarshaller(); // PrototypeMarshaller<I>.getMessagePrototype will always parse to I @SuppressWarnings("unchecked") final O msg = (O) deserializeProto(message.buf(), (Message) marshaller.getMessagePrototype()); return msg; default: // Fallback to using the method's stream marshaller. messageStream = new ByteBufInputStream(message.buf().retain(), true); break; } } finally { if (!unsafeWrapDeserializedBuffer) { message.buf().release(); } } } try (InputStream msg = messageStream) { return method.parseResponse(msg); } }
public O deserializeResponse(ByteBufOrStream message) throws IOException { InputStream messageStream = message.stream(); if (message.buf() != null) { try { switch (responseType) { case PROTOBUF: final PrototypeMarshaller<O> marshaller = (PrototypeMarshaller<O>) method.getResponseMarshaller(); // PrototypeMarshaller<I>.getMessagePrototype will always parse to I @SuppressWarnings("unchecked") final O msg = (O) deserializeProto(message.buf(), (Message) marshaller.getMessagePrototype()); return msg; default: // Fallback to using the method's stream marshaller. messageStream = new ByteBufInputStream(message.buf().retain(), true); break; } } finally { if (!unsafeWrapDeserializedBuffer) { message.buf().release(); } } } try (InputStream msg = messageStream) { return method.parseResponse(msg); } }