473,406 Members | 2,439 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,406 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 1448

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.