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