@Override public Response parseResponse(byte[] bytes) throws IOException { ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes); CodedInputStream inputStream = byteString.newCodedInput(); // Enable aliasing to avoid an extra copy to get at the serialized Response inside of the // WireMessage. inputStream.enableAliasing(true); WireMessage wireMsg = WireMessage.parseFrom(inputStream); String serializedMessageClassName = wireMsg.getName(); try { ResponseTranslator translator = getParserForResponse(serializedMessageClassName); return translator.transform(wireMsg.getWrappedMessage()); } catch (RuntimeException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to parse response message '{}'", TextFormat.shortDebugString(wireMsg)); } throw e; } } }
@Override public Response parseResponse(byte[] bytes) throws IOException { ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes); CodedInputStream inputStream = byteString.newCodedInput(); // Enable aliasing to avoid an extra copy to get at the serialized Response inside of the // WireMessage. inputStream.enableAliasing(true); WireMessage wireMsg = WireMessage.parseFrom(inputStream); String serializedMessageClassName = wireMsg.getName(); try { ResponseTranslator translator = getParserForResponse(serializedMessageClassName); return translator.transform(wireMsg.getWrappedMessage()); } catch (RuntimeException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to parse response message '{}'", TextFormat.shortDebugString(wireMsg)); } throw e; } } }
@Override public Request parseRequest(byte[] bytes) throws IOException { ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes); CodedInputStream inputStream = byteString.newCodedInput(); // Enable aliasing to avoid an extra copy to get at the serialized Request inside of the // WireMessage. inputStream.enableAliasing(true); WireMessage wireMsg = WireMessage.parseFrom(inputStream); String serializedMessageClassName = wireMsg.getName(); try { RequestTranslator translator = getParserForRequest(serializedMessageClassName); // The ByteString should be logical offsets into the original byte array return translator.transform(wireMsg.getWrappedMessage()); } catch (RuntimeException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to parse request message '{}'", TextFormat.shortDebugString(wireMsg)); } throw e; } }
@Override public Request parseRequest(byte[] bytes) throws IOException { ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes); CodedInputStream inputStream = byteString.newCodedInput(); // Enable aliasing to avoid an extra copy to get at the serialized Request inside of the // WireMessage. inputStream.enableAliasing(true); WireMessage wireMsg = WireMessage.parseFrom(inputStream); String serializedMessageClassName = wireMsg.getName(); try { RequestTranslator translator = getParserForRequest(serializedMessageClassName); // The ByteString should be logical offsets into the original byte array return translator.transform(wireMsg.getWrappedMessage()); } catch (RuntimeException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to parse request message '{}'", TextFormat.shortDebugString(wireMsg)); } throw e; } }
@Override public Response parseResponse(byte[] bytes) throws InvalidProtocolBufferException { WireMessage wireMsg = WireMessage.parseFrom(bytes); String serializedMessageClassName = wireMsg.getName(); ResponseTranslator translator = getParserForResponse(serializedMessageClassName); return translator.transform(wireMsg.getWrappedMessage()); } }
@Override public Request parseRequest(byte[] bytes) throws InvalidProtocolBufferException { WireMessage wireMsg = WireMessage.parseFrom(bytes); String serializedMessageClassName = wireMsg.getName(); RequestTranslator translator = getParserForRequest(serializedMessageClassName); return translator.transform(wireMsg.getWrappedMessage()); }