473,287 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Reading Binary Content from a File and Filtering it

Neo
Hello:

I am receiving a Binary File in a Request from a application. The
stream which comes to me has the boundary (Something like
"---------------------------390C0F3E0099" without the quotes), and also
some more text like this and file name (e.g. "Content-Disposition:
form-data; name="upload_file"; filename="C:\testing\myfile.dat"
Content-Type: application/octet-stream")

The binary content starts after "application/octet-stream".

The end of the file is also a boundary.

I need to filter this content and only write the binary content to the
disk.

I know the boundary string from the Request Headers and also the file
size. I am reading the request into a byte array using the following
code -

<code>
int iLength = (int) Request.InputStream.Length;
byte[] byBuffer = new byte[iLength];
Request.InputStream.Read(byBuffer,0,iLength);
</code>

Then i am using a filestream object to write the buffer to disk.

I dont know how to filter/replace the binary content. I tried to
convert it into a String object, but the file sizes are more than 2 MB,
and i dont want the string object to hold os much data.

Can someone please suggest any method of replacing some text in a
Binary content. I want to remove the boundary text from the stream.

Regards

Sunil Jambekar

Nov 19 '05 #1
0 1425

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: guillaume | last post by:
I have to read and process a large ASCII file containing a mesh : a list of points and triangles. The file is 100 MBytes. I first tried to do it in memory but I think I am running out of memory...
2
by: Boris Boutillier | last post by:
HI all, I came across a strange behaviour with read method, and I'm not sure if this is a filesystem problem or a misuse of this method. I do the simple following thing : f = open...
20
by: ishmael4 | last post by:
hello everyone! i have a problem with reading from binary file. i was googling and searching, but i just cant understand, why isnt this code working. i could use any help. here's the source code:...
8
by: Vijay | last post by:
Hi. I have a binary file which is on a CD it has filesize around 300 MB. Its not a text file. I want to read it and copy its content to a new file on hard disk. I dont want to use filecopy. I...
3
by: Sivaraj G via .NET 247 | last post by:
We created a unicode file using java application. It usesmethods like writeUTF(), writeInt() of java.io.DataOutputStreamclass to write the content of the file. We are able to read datausing...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
0
by: Smoke | last post by:
Im developing a custom app that has to read a file generated from other program, actually, the file is pretty much a mail message, which contains the subject, to, from, body, etc etc and also the...
3
by: The Cool Giraffe | last post by:
Regarding the following code i have a problem. void read () { fstream file; ios::open_mode opMode = ios::in; file.open ("some.txt", opMode); char *ch = new char; vector <charv; while...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.