Java Reference
In-Depth Information
if (inLineBreak)
{
os.write(lineSep);
hadCR = hadLF = inLineBreak = false;
}
os.write(ch);
}
}
} while (ch != -1);
}
/**
* Download a binary file. This means make an exact
* copy of the incoming stream.
*
* @param is The input stream, which is the URL.
* @param os The output stream, a local file.
* @throws IOException Exception while downloading.
*/
private void downloadBinary(InputStream is, OutputStream os)
throws IOException
{
byte buffer[] = new byte[BUFFER_SIZE];
int size = 0;
do
{
size = is.read(buffer);
if (size != -1)
os.write(buffer, 0, size);
} while (size != -1);
}
/**
* Typical Java main method, create an object, and then
* start the object passing arguments. If insufficient
* arguments are provided, then display startup
* instructions.
*
* @param args Program arguments.
*/
public static void main(String args[])
{
try
{
Search WWH ::




Custom Search