[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-EasyFTP-green.svg?style=flat)](https://android-arsenal.com/details/1/2499)
# EasyFTP
A Simple Wrapper Class for Apache-commons FTPClient to Easily Upload/Download Any kind of File over FTP. This Library
is targeted for novice developers and providies very minimialistic and easily understandable Interface for FTP usage.
# FEATURES :
* Simple and Minimialistic with Default Configurations.
* Totally Customizable (with provisional Access to Apache-commons FTPClient Methods).
* Ideal for Novice Developers with no FTP background Knowledge and experiance.
* Demo application Source Code Included.
# Demo & Testing :
You can [Download APK](http://www.mediafire.com/download/aqv09p5e9z7uvk3/app-debug.apk) for testing. This Demo app. will upload a test.png image file on specified server and downloads specified file to your device for server.
![alt tag](http://s8.postimg.org/wc2z7xqnp/image.png) ![alt tag](http://s16.postimg.org/e1202pghx/image.png)
You can use your public FTP Servers for testing like [This one](https://www.swfwmd.state.fl.us/data/ftp/)
# USAGE :
All methods of library Throw Exceptions to be handeled in method-calling body. FTP operations should be performed in ASYNCTASK ( UI independent Thread ). Several use cases are discussed below :
### Add this to your build.gradle dependenies of your module :
```java
dependencies {
compile 'com.adeel:easyFTP:1.0'
//...other dependencies
}
```
Make sure that your top level build.gradle has JCenter() repo :
```java
allprojects {
repositories {
jcenter()
//...other repos.
}
}
```
## Connecting to FTP Server :
Method :
```java
public void connect(String Address, String userName, String password); //using Default port 21
```
## Uploading to FTP Server :
Methods :
```java
public void uploadFile(String uri); //By giving File Path of File existing on Device , to be uploaded.
```
OR
```java
public void uploadFile(InputStream srcFileStream, String name); //By passing InputFileStream and //FileName.Extention
```
Example of Uploading some Resource Image (existing in res/drawable)
```java
class uploadTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
try {
easyFTP ftp = new easyFTP();
ftp.connect("address","username","password");
boolean status=false;
status=ftp.setWorkingDirectory("Files/Uploads/Images"); // if User say provided any Destination then Set it , otherwise
// Upload will be stored on Default /root level on server
InputStream is=getResources().openRawResource(+R.drawable.easyftptest);
ftp.uploadFile(is,"test.png");
return new String("Upload Successful");
}catch (Exception e){
String t="Failure : " + e.getLocalizedMessage();
return t;
}
}
}
```
## Downloading to From Server :
Methods :
```java
public void downloadFile(String TargetFilePath, String destination);
```
Example of Downloading Image (existing on Files/Uploads)
```java
class downloadTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
try {
easyFTP ftp = new easyFTP();
InputStream is=getResources().openRawResource(+R.drawable.easyftptest);
ftp.connect("address","username","password");
ftp.downloadFile( "Files/Uploads/test.png" , "downloaded_image.png" );
return new String("Download Successful");
}catch (Exception e){
String t="Failure : " + e.getLocalizedMessage();
return t;
}
}
```
## Compression (Mode-Z) :
You can send a File in compress mode which can reduce size of certain files to speed up transfers. [Read more about it]( http://stackoverflow.com/questions/26420836/does-apache-ftp-client-compress-files-while-transfer)
## Other Methods :
```java
public void setFtpClient(FTPClient mFtpClient); // Set Your own Customized FTPClient
public String [] listName (); // Returns List of Files in current working directory
public boolean setWorkingDirectory (String dir); // Sets Working Directory
public FTPClient getFtpClient() // Returns Private member FTPClient, Apache-commons FTPClient operations
// can be performed on this allowing complete customization.
public void setTimeout (int seconds); // Sets Connection timout , default is 10 secs.
public boolean makeDir(String dir); // Creates Directory on server at given path
public void disconnect(); // Disconnects FTPClient
```
## LICENSE
Copyright 2015-2016 ADEEL AHMAD
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
没有合适的资源?快使用搜索试试~ 我知道了~
Android代码-EasyFTP 一个Android Ftp客户端,可以方便的通过gradle引用
共43个文件
xml:14个
png:5个
java:4个
需积分: 11 15 下载量 69 浏览量
2019-08-06
04:57:56
上传
评论 1
收藏 372KB ZIP 举报
温馨提示
EasyFTP A Simple Wrapper Class for Apache-commons FTPClient to Easily Upload/Download Any kind of File over FTP. This Library is targeted for novice developers and providies very minimialistic and easily understandable Interface for FTP usage. FEATURES : Simple and Minimialistic with Default Configurations. Totally Customizable (with provisional Access to Apache-commons FTPClient Methods). Ideal for Novice Developers with no FTP background Knowledge and experiance. Demo application Source Code
资源推荐
资源详情
资源评论
收起资源包目录
Android代码-EasyFTP 一个Android Ftp客户端,可以方便的通过gradle引用.zip (43个子文件)
easyFTP-master
gradlew.bat 2KB
gradlew 5KB
gradle.properties 855B
library
proguard-rules.pro 672B
src
androidTest
java
com
adeel
library
ApplicationTest.java 348B
main
res
values
strings.xml 70B
java
com
adeel
library
easyFTP.java 5KB
AndroidManifest.xml 210B
.gitignore 7B
build.gradle 582B
library.iml 7KB
libs
commons-net-3.3.jar 274KB
app
proguard-rules.pro 672B
src
androidTest
java
com
adeel
easyftp
ApplicationTest.java 348B
main
res
drawable
easyftptest.png 30KB
mipmap-hdpi
ic_launcher.png 3KB
values
strings.xml 238B
styles.xml 194B
dimens.xml 211B
mipmap-xxhdpi
ic_launcher.png 8KB
mipmap-mdpi
ic_launcher.png 2KB
mipmap-xhdpi
ic_launcher.png 5KB
layout
activity_demo.xml 4KB
values-w820dp
dimens.xml 358B
java
com
adeel
easyftp
demo.java 6KB
AndroidManifest.xml 917B
app.iml 7KB
.gitignore 7B
build.gradle 614B
gradle
wrapper
gradle-wrapper.jar 49KB
gradle-wrapper.properties 232B
.idea
gradle.xml 661B
misc.xml 972B
vcs.xml 180B
.name 7B
copyright
profiles_settings.xml 74B
modules.xml 464B
compiler.xml 686B
.gitignore 91B
README.md 6KB
settings.gradle 27B
easyFTP.iml 913B
build.gradle 436B
共 43 条
- 1
资源评论
weixin_39840650
- 粉丝: 409
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- video_20240425_124410_edit.mp4
- IMG_20240425_120538.jpg
- My Complete Genome_6k Base-Pairs of Phenotype SNPs_Complete Raw Data.zip
- qt 的mqtt测试demo
- 移动应用开发教程-zip.zip
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功