edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.net.ftp
Class AbstractFTPInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.enterprisedt.net.ftp.FileTransferInputStream
          extended by com.enterprisedt.net.ftp.AbstractFTPInputStream
All Implemented Interfaces:
java.io.Closeable

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: 1.2 $
Author:
Bruce Blackshaw

Field Summary
protected  FTPClient client
          The client being used to perform the transfer
protected  java.io.BufferedInputStream in
          The input stream from the FTP server
 
Fields inherited from class com.enterprisedt.net.ftp.FileTransferInputStream
closed, monitor, monitorCount, monitorEx, monitorInterval, pos, remoteFile, started
 
Constructor Summary
AbstractFTPInputStream(FTPClient client, java.lang.String remoteFile)
          Constructor.
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
protected  void start()
           
protected  void start(boolean firstTime)
          Start the transfer
 
Methods inherited from class com.enterprisedt.net.ftp.FileTransferInputStream
checkMonitor, getRemoteFile, setMonitor
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

protected FTPClient client
The client being used to perform the transfer


in

protected java.io.BufferedInputStream in
The input stream from the FTP server

Constructor Detail

AbstractFTPInputStream

public AbstractFTPInputStream(FTPClient client,
                              java.lang.String remoteFile)
                       throws java.io.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:
java.io.IOException
FTPException
Method Detail

start

protected void start()
              throws java.io.IOException
Throws:
java.io.IOException

start

protected void start(boolean firstTime)
              throws java.io.IOException
Start the transfer

Throws:
java.io.IOException

close

public void close()
           throws java.io.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 java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException - if an I/O error occurs.


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.