Class HTTPInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    GassInputStream

    public class HTTPInputStream
    extends GlobusInputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.InputStream input  
      protected long size  
      protected java.net.Socket socket  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected HTTPInputStream()
      Private constructor used by subclasses.
        HTTPInputStream​(java.lang.String host, int port, java.lang.String file)
      Opens HTTP input stream connection (unsecure)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort()
      Aborts transfer.
      int available()  
      void close()  
      protected void get​(java.lang.String host, int port, java.lang.String file)  
      long getSize()
      Returns the total size of input data.
      protected java.net.Socket openSocket​(java.lang.String host, int port)  
      int read()  
      int read​(byte[] msg)  
      int read​(byte[] buf, int off, int len)  
      • Methods inherited from class java.io.InputStream

        mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • input

        protected java.io.InputStream input
      • socket

        protected java.net.Socket socket
      • size

        protected long size
    • Constructor Detail

      • HTTPInputStream

        protected HTTPInputStream()
        Private constructor used by subclasses.
      • HTTPInputStream

        public HTTPInputStream​(java.lang.String host,
                               int port,
                               java.lang.String file)
                        throws java.io.IOException
        Opens HTTP input stream connection (unsecure)
        Parameters:
        host - host name of the HTTP server.
        port - port number of the HTTP server.
        file - file to retrieve from the server.
        Throws:
        java.io.IOException
    • Method Detail

      • openSocket

        protected java.net.Socket openSocket​(java.lang.String host,
                                             int port)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • get

        protected void get​(java.lang.String host,
                           int port,
                           java.lang.String file)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • abort

        public void abort()
        Description copied from class: GlobusInputStream
        Aborts transfer. Usually makes sure to release all resources (sockets, file descriptors)
        Does nothing by default.
        Overrides:
        abort in class GlobusInputStream
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] msg)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] buf,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class GlobusInputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException