Class FileProvider

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<java.io.File>, javax.ws.rs.ext.MessageBodyWriter<java.io.File>

    @Produces({"application/octet-stream","*/*"})
    @Consumes({"application/octet-stream","*/*"})
    @Singleton
    public final class FileProvider
    extends AbstractMessageReaderWriterProvider<java.io.File>
    Provider for marshalling/un-marshalling of application/octet-stream entity type to/from a File instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileProvider()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getSize​(java.io.File t, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      boolean isReadable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      boolean isWriteable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      java.io.File readFrom​(java.lang.Class<java.io.File> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders, java.io.InputStream entityStream)  
      void writeTo​(java.io.File t, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders, java.io.OutputStream entityStream)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileProvider

        public FileProvider()
    • Method Detail

      • isReadable

        public boolean isReadable​(java.lang.Class<?> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
      • readFrom

        public java.io.File readFrom​(java.lang.Class<java.io.File> type,
                                     java.lang.reflect.Type genericType,
                                     java.lang.annotation.Annotation[] annotations,
                                     javax.ws.rs.core.MediaType mediaType,
                                     javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders,
                                     java.io.InputStream entityStream)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • isWriteable

        public boolean isWriteable​(java.lang.Class<?> type,
                                   java.lang.reflect.Type genericType,
                                   java.lang.annotation.Annotation[] annotations,
                                   javax.ws.rs.core.MediaType mediaType)
      • writeTo

        public void writeTo​(java.io.File t,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders,
                            java.io.OutputStream entityStream)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getSize

        public long getSize​(java.io.File t,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<java.io.File>
        Overrides:
        getSize in class AbstractMessageReaderWriterProvider<java.io.File>