How to avoid byte stream array

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.