1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 00:03:53 +02:00

bug fix - using the wrong stream to read from

This commit is contained in:
David McKnight 2006-06-21 18:53:18 +00:00
parent be40636e0e
commit b85b1b6995

View file

@ -141,7 +141,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
public boolean upload(IProgressMonitor monitor, InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding) throws SystemMessageException public boolean upload(IProgressMonitor monitor, InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding) throws SystemMessageException
{ {
boolean isCancelled = false; boolean isCancelled = false;
FileInputStream inputStream = null;
BufferedInputStream bufInputStream = null; BufferedInputStream bufInputStream = null;
FileOutputStream outputStream = null; FileOutputStream outputStream = null;
BufferedOutputStream bufOutputStream = null; BufferedOutputStream bufOutputStream = null;
@ -173,7 +173,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
destinationParent.mkdirs(); destinationParent.mkdirs();
} }
bufInputStream = new BufferedInputStream(inputStream); bufInputStream = new BufferedInputStream(stream);
outputStream = new FileOutputStream(destinationFile); outputStream = new FileOutputStream(destinationFile);
// if encoding conversion required, then we need a writer // if encoding conversion required, then we need a writer
@ -187,9 +187,14 @@ public class LocalFileService extends AbstractFileService implements IFileServic
{ {
bufOutputStream = new BufferedOutputStream(outputStream); bufOutputStream = new BufferedOutputStream(outputStream);
} }
byte[] buffer = new byte[512000]; byte[] buffer = new byte[512000];
int readCount = 0; int readCount = 0;
int available = bufInputStream.available();
System.out.println("available = "+available);
while( (readCount = bufInputStream.read(buffer)) > 0 && !isCancelled) while( (readCount = bufInputStream.read(buffer)) > 0 && !isCancelled)
{ {
if (isEncodingConversionRequired) if (isEncodingConversionRequired)
@ -217,6 +222,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
} }
catch (IOException e) catch (IOException e)
{ {
e.printStackTrace();
} }
finally finally
{ {