Forums Register Login
Drowning need someone to throw me a line.
I am posting a file from an applet to a servlet, problem is it is slow, the file unwantedly cached in memory before transmitting and I don't know how to get the ammount of data that has been sent(It seems that flushing the buffer and counting what you put in it is utterly useless; note I'm using this to draw my progress bar). I need some help here because this project is in danger.
-a man in need
I would need a few more details to completely figure this out but, it would seem that you aren't using the correct InputStreams to do this. Can you post the code where you read the file in and write it to the URLConnection?
class FileBG extends Thread
public ProgressBar pgbar;
private BarBG barthread;
private DataInputStream datain;
private DataOutputStream dataout;;
private long filesize;
private ByteThread bytethread;
public void run()
long byteswritten = 0;
float percentup = 0;
byte[] outarray = new byte[2048];
while (true)
close and catch here
Hope you can help me now.
Sorry forgot the URLConnection setup
File outfile = new File(globalfilestr);
URL location = new URL(getCodeBase(), "");
URLConnection out = location.openConnection();
out.setRequestProperty("Content-Type", "application/x-java-serialized-object");
out.setRequestProperty("Filename", globalfilename);
DataInputStream datain = new DataInputStream(filein);
DataOutputStream dataout = new DataOutputStream(out.getOutputStream());
Would you like to try a free sample? Today we are featuring tiny ads:
Why should you try IntelliJ IDEA ?

This thread has been viewed 595 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 23, 2018 04:04:35.