Clover icon

sunshower-sdk

  1. Project Clover database Sat May 12 2018 05:15:40 UTC
  2. Package io.sunshower.sdk.v1.core

File OctetStreamWriter.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
40% of files have more coverage

Code metrics

0
3
3
1
32
27
3
1
1
3
1

Classes

Class Line # Actions
OctetStreamWriter 16 3 3
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.sdk.v1.core;
2   
3    import javax.ws.rs.Produces;
4    import javax.ws.rs.WebApplicationException;
5    import javax.ws.rs.core.MediaType;
6    import javax.ws.rs.core.MultivaluedMap;
7    import javax.ws.rs.ext.MessageBodyWriter;
8    import javax.ws.rs.ext.Provider;
9    import java.io.IOException;
10    import java.io.OutputStream;
11    import java.lang.annotation.Annotation;
12    import java.lang.reflect.Type;
13   
14    @Provider
15    @Produces(MediaType.APPLICATION_OCTET_STREAM)
 
16    public class OctetStreamWriter implements MessageBodyWriter {
 
17  0 toggle @Override
18    public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) {
19  0 return mediaType.isCompatible(MediaType.APPLICATION_OCTET_STREAM_TYPE);
20    }
21   
 
22  0 toggle @Override
23    public long getSize(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) {
24  0 return 0;
25    }
26   
 
27  0 toggle @Override
28    public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
29   
30  0 System.out.println(o);
31    }
32    }