I'm trying to process large concatenated files and split them back into individual files. For anyone who wants to know, searchString contains the magic numbers that make up the file headers and is used to tell where each file begins.
This line
string dataString = String.Concat(dataByte.Select(b => b.ToString("x2")));
...results in a:
Out of Memory exception
I have seen a few different ways that large files can be processed, but none of those approaches seem to handle the data the way I need this program to. Is there any way to correct the Out of Memory exception without changing anything inside the foreach loop?
byte[] dataByte = File.ReadAllBytes(pathString);
string dataString = String.Concat(dataByte.Select(b => b.ToString("x2")));
string[] LineArray = Regex.Split(dataString, searchString);
foreach (string LineResult in LineArray)
{
//The string processing operations go here.
//The individual files are created from the output.
}
Aucun commentaire:
Enregistrer un commentaire