Curious problem.
For an ftp-client I have a BufferedInputStream retrieved from the
ftp-server (proftpd). I read from it and write the File through
BufferedOutputStream(new FileOutputStream()) to Disk. Now, the file
written to disk is some K greater than the file read of:

File on my virtual FTP-Server:
 #> l big-file.zip
-r-xr-xr-x   1 root     root     15598221 Mär 29 20:02 big-file.zip*

# > l /tmp/even-bigger-file.zip
-rw-r--r--   1 willi    users    15655752 Apr 23 14:06
/tmp/even-bigger-file.zip

Some clues to it?

The routine that connects that connects the FTP-Server Stream to my
local file stream is:
 public boolean download(BufferedInputStream _remoteInputStream, long
_fileSize, String _localFile) throws UnknownHostException, IOException
  {
    long progress=0;
    BufferedOutputStream bos = new
BufferedOutputStream(outputDataCommand("STOR " + _localFile));
    File localFile = new File(_localFile);
    BufferedInputStream bis = _remoteInputStream;

    long fileSize = _fileSize;

    byte b[] = new byte[BLOCKSIZE];
    int byteRead;

    while((byteRead = bis.read(b, 0, BLOCKSIZE)) != -1)
    {
      //if (progress > 0) raf.seek(progress); // is resume implemented
at any server ?
      bos.write(b, 0, byteRead);

      progress += byteRead;

      eventListener.progressChanged((int)(100*progress/fileSize));   //
update progress
    }

    bis.close();
    bos.close();

    return true;
  }

Is this related to the endian-problem java has (the files above are
Windows-zipped ones)?
Any help appreciated.
willi


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to