Marshalls UTF-8 encoded strings.
| 25 | |
| 26 | /** Marshalls UTF-8 encoded strings. */ |
| 27 | public class StringMarshaller implements MethodDescriptor.Marshaller<String> { |
| 28 | public static StringMarshaller INSTANCE = new StringMarshaller(); |
| 29 | |
| 30 | @Override |
| 31 | public InputStream stream(String value) { |
| 32 | return new ByteArrayInputStream(value.getBytes(UTF_8)); |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | public String parse(InputStream stream) { |
| 37 | try { |
| 38 | return new String(ByteStreams.toByteArray(stream), UTF_8); |
| 39 | } catch (IOException ex) { |
| 40 | throw new RuntimeException(ex); |
| 41 | } |
| 42 | } |
| 43 | } |
nothing calls this directly
no outgoing calls
no test coverage detected