Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.accidia.protoserver.providers;
 
 
public class BinaryMessageReader implements MessageBodyReader<byte[]> {
    private static final Logger logger = LoggerFactory.getLogger(BinaryMessageReader.class);
    @Override
    public boolean isReadable(final Class<?> type,
                              final Type genericType,
                              final Annotation[] annotations,
                              final MediaType mediaType) {
        return Message.class.isAssignableFrom(type);
    }
    @SuppressWarnings("unchecked")
    @Override
    public byte[] readFrom(final Class<byte[]> type,
                                 final Type genericType,
                                 final Annotation[] annotations,
                                 final MediaType mediaType,
                                 final MultivaluedMap<StringStringhttpHeaders,
                                 final InputStream inputStreamthrows IOExceptionWebApplicationException {
        return ByteStreams.toByteArray(inputStream);
    }
New to GrepCode? Check out our FAQ X