B4J Question Copy remaining part of inputStream to a file

wl

Well-Known Member
Licensed User
Hi,

If I have an inputstream (eg: in a webhandler) and I first read a number of bytes from it through "ReadBytes" and then do a File.Copy2 to copy the stream, will it copy from the current position on ?

I would like to be able to upload a JSON string and a file at the same time back and forth between a B4J webserver and a B4I client and I would like to avoid using zips (which I could use it seems) because I then would need to copy files and so on ..

Thank
 

Erel

Administrator
Staff member
Licensed User
will it copy from the current position on ?
Yes.

I would like to be able to upload a JSON string and a file at the same time back and forth between a B4J webserver and a B4I client and I would like to avoid using zips (which I could use it seems) because I then would need to copy files and so on ..
Would be simpler to create a custom type with an array of bytes and any other information you like, serialize it with B4XSerializator and send it.

The custom type should be declared in the main module of both projects.
 
  • Like
Reactions: wl

wl

Well-Known Member
Licensed User
Yes.


Would be simpler to create a custom type with an array of bytes and any other information you like, serialize it with B4XSerializator and send it.

The custom type should be declared in the main module of both projects.
Would that mean that the file needs to be taken fully in memory ? By using streams I would be able to avoid this, no ?
 
Top