Download Large Files using java
- by angelina
Dear All,
I M building a application in which i want to download large files on handset
(mobile),but if size of file is large i m getting exception socket exception-broken pipe .
inputStream = new FileInputStream(path);
byte[] buffer = new byte[1024];
int bytesRead = 0;
do
{
bytesRead = inputStream.read(buffer, offset, buffer.length);
resp.getOutputStream().write(buffer, 0, bytesRead);
}
while (bytesRead == buffer.length);
resp.getOutputStream().flush();
}