protected GlobusOutputStream getOutputStream ( long size ) throws Exception { GlobusOutputStream out = null ; String toP = dstUrl . getProtocol ( ) ; String toFile = dstUrl . getPath ( ) ; if ( toP . equalsIgnoreCase ( "file" ) ) { toFile = URLDecoder . decode ( toFile ) ; out = new GlobusFileOutputStream ( toFile , appendMode ) ; } else if ( toP . equalsIgnoreCase ( "ftp" ) ) { toFile = URLDecoder . decode ( toFile ) ; out = new FTPOutputStream ( dstUrl . getHost ( ) , dstUrl . getPort ( ) , dstUrl . getUser ( ) , dstUrl . getPwd ( ) , toFile , appendMode ) ; } else if ( toP . equalsIgnoreCase ( "gsiftp" ) || toP . equalsIgnoreCase ( "gridftp" ) ) { Authorization auth = getDestinationAuthorization ( ) ; if ( auth == null ) { auth = HostAuthorization . getInstance ( ) ; } toFile = URLDecoder . decode ( toFile ) ; out = new GridFTPOutputStream ( getDestinationCredentials ( ) , auth , dstUrl . getHost ( ) , dstUrl . getPort ( ) , toFile , appendMode , getDCAU ( ) , ( disableAllo ? - 1 : size ) ) ; } else if ( toP . equalsIgnoreCase ( "https" ) ) { Authorization auth = getDestinationAuthorization ( ) ; if ( auth == null ) { auth = SelfAuthorization . getInstance ( ) ; } out = new GassOutputStream ( getDestinationCredentials ( ) , auth , dstUrl . getHost ( ) , dstUrl . getPort ( ) , toFile , size , appendMode ) ; } else if ( toP . equalsIgnoreCase ( "http" ) ) { out = new HTTPOutputStream ( dstUrl . getHost ( ) , dstUrl . getPort ( ) , toFile , size , appendMode ) ; } else { throw new Exception ( "Destination protocol: " + toP + " not supported!" ) ; } return out ; }
Returns output stream based on the destination url .