0% found this document useful (0 votes)
37 views1 page

4 Oc

The document describes a process for sending an image to a server using a byte array. It involves converting a ByteArrayOutputStream to a byte array, closing the stream, and then writing the byte array to an output stream. The process includes logging messages indicating the start and completion of the image transfer.

Uploaded by

hello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

4 Oc

The document describes a process for sending an image to a server using a byte array. It involves converting a ByteArrayOutputStream to a byte array, closing the stream, and then writing the byte array to an output stream. The process includes logging messages indicating the start and completion of the image transfer.

Uploaded by

hello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

byte[] bytes = baos.

toByteArray();
baos.close();
System.out.println("Sending image to server.");
OutputStream out = soc.getOutputStream();
DataOutputStream dos = new DataOutputStream(out);
dos.writeInt(bytes.length);
dos.write(bytes, 0, bytes.length);
System.out.println("Image sent to server. ");

You might also like