home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / VJ11 / VJTRIAL.EXE / IE30Java.exe / classd.exe / sun / net / ftp / FtpInputStream.java < prev    next >
Encoding:
Java Source  |  1997-01-27  |  2.0 KB  |  60 lines

  1. /*
  2.  * @(#)FtpInputStream.java    1.5 95/08/29 Chris Warth
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package sun.net.ftp;
  21.  
  22. import java.io.FilterInputStream;
  23. import java.io.InputStream;
  24. import java.io.IOException;
  25. import sun.net.TelnetInputStream;
  26.  
  27. /*
  28.  * The only purpose of this class is to hold onto an instance of
  29.  * FtpClient to prevent the FtpClient from being garbage collected.
  30.  * If the client gets collected it will close the command stream
  31.  * which will cause the remote ftp daemon to close its outputstream
  32.  * which will cause and EOF on this inputstream on our end.  
  33.  *
  34.  * The real answer is to re-architect all this stuff to not open an
  35.  * ftp connection each time the user needs something from the remote
  36.  * side.  The other correct thing it to totally ignore all the ftp
  37.  * client stuff and just use the ftp proxy stuff in the CERN HTTP
  38.  * server.
  39.  *
  40.  * @version    1.5, 08/29/95
  41.  * @author    Chris Warth
  42.  */
  43.  
  44. public class FtpInputStream extends TelnetInputStream {
  45.     FtpClient ftp;
  46.  
  47.     FtpInputStream(FtpClient ftp, InputStream fd, boolean binary) {
  48.     super(fd, binary);
  49.     this.ftp = ftp;
  50.     }
  51.  
  52.     public void close() {
  53.     try {
  54.         ftp.closeServer();
  55.         super.close();
  56.     } catch (IOException e) {
  57.     }
  58.     }
  59. }
  60.