Class BaseZeroCopyRequestProducer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.http.nio.protocol.HttpAsyncRequestProducer
    Direct Known Subclasses:
    ZeroCopyPost, ZeroCopyPut

    abstract class BaseZeroCopyRequestProducer
    extends java.lang.Object
    implements org.apache.http.nio.protocol.HttpAsyncRequestProducer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.RandomAccessFile accessfile  
      private org.apache.http.entity.ContentType contentType  
      private java.io.File file  
      private java.nio.channels.FileChannel fileChannel  
      private long idx  
      private java.net.URI requestURI  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseZeroCopyRequestProducer​(java.net.URI requestURI, java.io.File file, org.apache.http.entity.ContentType contentType)  
    • Field Detail

      • requestURI

        private final java.net.URI requestURI
      • file

        private final java.io.File file
      • accessfile

        private final java.io.RandomAccessFile accessfile
      • contentType

        private final org.apache.http.entity.ContentType contentType
      • fileChannel

        private java.nio.channels.FileChannel fileChannel
      • idx

        private long idx
    • Constructor Detail

      • BaseZeroCopyRequestProducer

        protected BaseZeroCopyRequestProducer​(java.net.URI requestURI,
                                              java.io.File file,
                                              org.apache.http.entity.ContentType contentType)
                                       throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
    • Method Detail

      • closeChannel

        private void closeChannel()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • createRequest

        protected abstract org.apache.http.HttpEntityEnclosingRequest createRequest​(java.net.URI requestURI,
                                                                                    org.apache.http.HttpEntity entity)
      • generateRequest

        public org.apache.http.HttpRequest generateRequest()
                                                    throws java.io.IOException,
                                                           org.apache.http.HttpException
        Specified by:
        generateRequest in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
        Throws:
        java.io.IOException
        org.apache.http.HttpException
      • getTarget

        public org.apache.http.HttpHost getTarget()
        Specified by:
        getTarget in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
      • produceContent

        public void produceContent​(org.apache.http.nio.ContentEncoder encoder,
                                   org.apache.http.nio.IOControl ioctrl)
                            throws java.io.IOException
        Specified by:
        produceContent in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
        Throws:
        java.io.IOException
      • requestCompleted

        public void requestCompleted​(org.apache.http.protocol.HttpContext context)
        Specified by:
        requestCompleted in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
      • failed

        public void failed​(java.lang.Exception ex)
        Specified by:
        failed in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
      • isRepeatable

        public boolean isRepeatable()
        Specified by:
        isRepeatable in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
      • resetRequest

        public void resetRequest()
                          throws java.io.IOException
        Specified by:
        resetRequest in interface org.apache.http.nio.protocol.HttpAsyncRequestProducer
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException