简体   繁体   English

分割流

[英]splitting a stream

如何将流分割成需要的大小,我需要将其通过套接字发送到另一个系统,然后我需要附加它们并创建一个FILE

Since it is by byte array, you could send it by chunk. 由于它是按字节数组发送的,因此可以按块发送它。 You must create 3 methods. 您必须创建3个方法。 The first will accept the total byte count and might return an id or filename (of the temporary file) where the current uploaded data is stored. 第一个将接受总字节数,并且可能返回(临时文件的)ID或文件名,其中存储了当前上载的数据。 2nd method is use to upload chunks of data (that is recognized by id, filename). 第二种方法用于上传数据块(可通过ID,文件名识别)。 3rd will inform that the process is completed (based on id, filename). 3rd将通知该过程已完成(基于id,文件名)。

When the 3rd process is completed you could do your stuff then (like save it to database, etc.) 当第三个过程完成时,您可以做一些事情(例如将其保存到数据库等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM