Thursday, February 13, 2014

FTP download from the picture into the case



Download thread:
 Runnable run = new Runnable () {
public void run () {
ContinueFTP ftp = new PhotoPre.ContinueFTP ();
try {
ftp.connect ("125.88.22.107", 21, "system", "& UJ");
List path = new ArrayList ();
path = ftp.getListFiles (ftpPath);
System.out.println ("-path-" + ftpPath + path);
StringBuffer sb = new StringBuffer ();
for (String str: path) {
Log.v (TAG, str);
System.out.println ("-" + ftpPath + str);
ftp.download (ftpPath + str, "/ mnt / sdcard /");
sb.append (str);
}
if (local! = null) {
BitmapFactory.Options options = new BitmapFactory.Options ();
options.inJustDecodeBounds = true;
Bitmap bm = BitmapFactory.decodeFile (local + ". Jpg",
options);
Log.v (TAG, bm.toString ());
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
bm.compress (Bitmap.CompressFormat.PNG, 100, baos);
byte [] target = new byte [4];
target = baos.toByteArray ();
Message message = Message.obtain ();
message.arg1 = 1;
message.obj = target;
messageHandler.sendMessage (message);
} Else {
System.out.println ("faultsable");

}
} Catch (Exception e) {
e.printStackTrace ();
}
}
};

This is the download method:
 public DownloadStatus download (String remote, String local) 
throws IOException {
ftpClient.enterLocalPassiveMode ();
ftpClient.setFileType (FTP.BINARY_FILE_TYPE);
DownloadStatus result;
FTPFile [] files = ftpClient.listFiles (new String (remote
. GetBytes ("UTF-8"), "iso-8859-1"));

if (files.length! = 1) {
System.out.println ("Remote file does not exist");
return DownloadStatus.Remote_File_Noexist;
}
long lRemoteSize = files [0] getSize ();.

List Path = new ArrayList ();
Path = getListFiles (ftpPath);
String [] filename = new String [Path.size ()];
for (int i = 0; i filename [i] = Path.get (i);
}
String path = Environment.getExternalStorageDirectory () + "/"
+ Filename;
File f = new File (path);
f.getParentFile () mkdir ();.
if (f.exists ()) {
long localSize = f.length ();
if (localSize> = lRemoteSize) {
System.out.println ("Local file is larger than the remote file download aborted");
return DownloadStatus.Local_Bigger_Remote;
}
/ / FileOutputStream out = new FileOutputStream (
/ / Environment.getExternalStorageDirectory () + "/"
/ / + Filename, true);
FileOutputStream out = new FileOutputStream (f, true);
ftpClient.setRestartOffset (localSize);
InputStream in = ftpClient.retrieveFileStream (new String (remote
. GetBytes ("UTF-8"), "iso-8859-1"));
byte [] bytes = new byte [1024];
long step = lRemoteSize / 100;
process = localSize / step;
int c;
while ((c = in.read (bytes))! = -1) {
out.write (bytes, 0, c);
localSize + = c;
long nowProcess = localSize / step;
if (nowProcess> process) {
process = nowProcess;
if (process% 10 == 0)
System.out.println ("download progress:" + process);
}
}
in.close ();
out.close ();
boolean isDo = ftpClient.completePendingCommand ();
if (isDo) {
result = DownloadStatus.Download_From_Break_Success;
} Else {
result = DownloadStatus.Download_From_Break_Failed;
}
} Else {
OutputStream out = new FileOutputStream (f);
InputStream in = ftpClient.retrieveFileStream (new String (remote
. GetBytes ("UTF-8"), "iso-8859-1"));
byte [] bytes = new byte [1024];
long step = lRemoteSize / 100;
long localSize = 0L;
int c;
while ((c = in.read (bytes))! = -1) {
out.write (bytes, 0, c);
localSize + = c;
long nowProcess = localSize / step;
if (nowProcess> process) {
process = nowProcess;
if (process% 10 == 0)
System.out.println ("download progress:" + process);
}
}
in.close ();
out.close ();
boolean upNewStatus = ftpClient.completePendingCommand ();
if (upNewStatus) {
result = DownloadStatus.Download_New_Success;
} Else {
result = DownloadStatus.Download_New_Failed;
}
}
return result;
}

Reply:
HD Uncensored:

Reply:
No conversion type. . . . . . .

No comments:

Post a Comment