001    package railo.commons.io.res.type.ftp;
002    
003    import java.io.IOException;
004    import java.io.InputStream;
005    
006    import railo.commons.io.res.util.ResourceInputStream;
007    
008    public final class FTPResourceInputStream extends ResourceInputStream {
009    
010            private final FTPResourceClient client;
011    
012            /**
013             * Constructor of the class
014             * @param res
015             * @param is
016             */
017            public FTPResourceInputStream(FTPResourceClient client,FTPResource res, InputStream is) {
018                    super(res, is);
019                    //print.ln("is:"+is);
020                    this.client=client;
021            }
022    
023            /**
024             * @see railo.commons.io.res.util.ResourceInputStream#close()
025             */
026            public void close() throws IOException {
027                    try {
028                            super.close();
029                    }
030                    finally {
031                            client.completePendingCommand();
032                            ((FTPResourceProvider)getResource().getResourceProvider()).returnClient(client);
033                    }
034            }
035    
036    }