How to deal with byte stream array recently encountered a problem, that is, the attachment is transmitted in the form of byte stream array, but do not know what to do. Now I want to transmit an attachment to another server and transmit the attachment through byte stream array. I searched for N for a long time on the Internet and couldn't find an example of PHP processing byte stream, I hope you can help me more. I provide a Java example. this is a Java program for processing the byte stream of attachments. How does JavacodeStringa & q process byte stream arrays?
Recently, I encountered an annoying problem, that is, transmitting attachments in the form of byte stream arrays, but I don't know what to do.
Now I want to transmit an attachment to another server and transmit the attachment through byte stream array. I searched for N for a long time on the Internet and couldn't find an example of PHP processing byte stream, I hope you can help me more.
I provide a Java example. this is a Java program for processing the byte stream of attachments.
Java code
String a="d://tmp.jpg";File fa=new File(a);FileInputStream fis = new FileInputStream(fa);byte[] tmp = new byte[fis.available()];
The final variable "tmp" is the final byte stream array. thank you for your help!
------ Solution --------------------
$ Src = fopen ('d: // tmp.jpg ', 'r ');
$ Tobyte = fopen ('d: // tmp.txt ', 'w ');
Stream_copy_to_stream ($ src, $ tobyte, 1024 );
In this case, d: // tmp.txt stores the d: // tmp.jpg text stream.
For more information, see The PHP Stream Function.
------ Solution --------------------
You can repeat the character stream file and save it to the data group.
PHP operation data comparison ticket
------ Solution --------------------
Discussion
Thank you, but I would like to ask how to generate a byte [] array from byte to JAVA.