Class AbstractFTPInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class AbstractFTPInputStream extends FileTransferInputStream
Represents an input stream of bytes coming from an FTP server, permitting the user to download a file by reading the stream. It can only be used for one download, i.e. after the stream is closed it cannot be reopened.
Version:
$Revision$
Author:
Bruce Blackshaw
  • Field Details

    • client

      protected FTPClient client
      The client being used to perform the transfer
    • in

      protected BufferedInputStream in
      The input stream from the FTP server
  • Constructor Details

    • AbstractFTPInputStream

      public AbstractFTPInputStream(FTPClient client, String remoteFile) throws IOException, FTPException
      Constructor. A connected FTPClient instance must be supplied. This sets up the download. If an offset > 0 is supplied, must be a binary transfer.
      Parameters:
      client - connected FTPClient instance
      remoteFile - remote file
      Throws:
      IOException
      FTPException
  • Method Details

    • start

      protected void start() throws IOException
      Throws:
      IOException
    • start

      protected void start(boolean firstTime) throws IOException
      Start the transfer
      Throws:
      IOException
    • close

      public void close() throws IOException
      Closes this input stream and releases any system resources associated with the stream. This must be called before any other operations are initiated on the FTPClient.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException - if an I/O error occurs.