Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why remotefile's size is biger than localfile's size?  RSS feed

 
robertb9527
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,nice to meet you!
I want to know why remotefile's size is biger than localfile's size?
help.

two method:
sun.net.ftp.FtpClient ftp;
1. java.io.FileInputStream inFile = new FileInputStream(esPath);
sun.net.TelnetOutputStream outFile = ftp.put(remoteFile);

byte[] bufferDirect = new byte[1024];
while (true) {
int iBy = inFile.read(bufferDirect);
if (iBy < 0)
break;

outFile.write(bufferDirect, 0, iBy);

}

inFile.close();
outFile.close();



2. RandomAccessFile sendFile=new RandomAccessFile(esPath,"r");
sendFile.seek(0);
TelnetOutputStream outs=ftp.put(remoteFile);
DataOutputStream outputs=new DataOutputStream(outs);
int ch;
while(sendFile.getFilePointer()<sendFile.length()){

ch=sendFile.read();
outputs.write(ch);

}

outs.close();sendFile.close();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!