16
votes
Can Mathematica edit large binary files in-place?
We can do it straightforward in Java using JLink:
...
16
votes
Accepted
How to read a named pipe on Windows?
Short Version
On Windows, unlike Unix, named pipes are special and do not behave like regular stdio streams. Programs that use named pipes require custom logic. As a rule the Wolfram Language I/O ...
10
votes
Is building an event-based parser possible/reasonable in Mathematica (WL)?
Note:
If you want this type of parser added for JSON, I think WRI could do it easily. They already have Developer`ReadRawJSONStream so I think adding some event-...
10
votes
Accepted
Is there a way to create ZIP OutputStream ?
As mentioned already it's easy to implement this functionality with JLink.
But once you use Java's ZipOtputStream you will need to convert your data to list of ...
7
votes
Can Mathematica edit large binary files in-place?
I have noticed that NETLink does not get a lot of love on this site (at least not as much as JLink does), so let me just post ...
7
votes
Accepted
how do I to create a function similar to feof in C?
Your ideas are too C-oriented. The Wolfram Language is not at all like C despite some syntactic sugar built into it to make some constructs C-like; In my opinion, these features more often lead ...
7
votes
Accepted
Can Read[] apply a custom function automatically to the read values?
Yes! This is documented under Details:
You can use Read to get objects to insert into any expression structure, not necessarily a list. Example: ...
7
votes
Reading from a socket stream
Beginning with Mathematica 10 there is a new function ReadString
to get the (current) available data from an open socket connection by setting ...
6
votes
Stream CSV or TSV files
Summary
This is generalized piece of code for reading FAST rows terminated with a newline from a CSV or TSV text stream with UTF8 encoding.
You may specify options for the filetype, the starting and ...
6
votes
How to pipe a stream to another notebook?
Here's a way that allows you to actually redirect output to a notebook by using the newish DefineStreamOutputMethod function (which dates to 9.0). It's a bit hacky ...
6
votes
Is there a way to create ZIP OutputStream ?
Neither the import format ZIP (nor any of those similar to it like GZIP, TAR or BZIP) nor the function CreateArchive do have any documented functionality which ...
6
votes
Vector field Stream?
Here are the streamlines using the centers of the arrows in the vector plot as initial conditions:
...
5
votes
Accepted
Matrix Vector multiplication for very big matrices (>>RAM)
You may use ParallelTable and other functions from the Parallel Computation Setup & Configuration guide.
With
...
5
votes
Read not advancing StreamPosition
Having written it up, I might as well answer having double-checked my thinking before posting, just in case I was about to make a fool of myself...
The problem lies on this line:
...
5
votes
Accepted
SliceStreamPlot3D or StreamPlot3D
Obviously, my earlier first suggestion is exactly what SliceVectorPlot3D does, a function I was not aware of. Therefore, here is my suggestion how to convert 2d <...
5
votes
Opening a pipe with OpenRead
Use sockets. For example, set up a listening connection in shell with
nc -l 2222
Then in Mathematica
...
5
votes
Accepted
How do I reliably read from stdin using wolframscript?
The implementation of $ScriptInputString in wolframscript is buggy. I have found that providing ...
5
votes
Accepted
How to read doubles from specific location of a large file
Make sure you use the right format for you floating point reals. E.g. with "Real64", where every number take 8 Bytes, we can write 3 numbers and then jump to the second number by:
...
5
votes
Accepted
Memory preserving computation in chunks
In general, a good strategy to free memory when no longer needed is to give the variables a local scope. However, when applying this too finely grained, this may cause many costly allocations and ...
5
votes
Accepted
Plotting phase plane in Filippov systems
This should be more straightforward with my EcoEvo package.
First, install package (once ever):
...
4
votes
Accepted
How can I dynamically display a stream position?
To not prompt Dynamic each second or something, let's create useless variable that will prompt it.
...

Kuba♦
- 136k
4
votes
Accepted
What is the fastest way to read the new lines in the dynamically updatable file?
Wolfram Support Answer
The input stream is "buffered" by C, which is to say the file's data is read into memory when the stream is opened. Then all "read" operations work on the buffered data in ...
3
votes
Can Mathematica edit large binary files in-place?
Mathematica is not a great tool to edit large files; the documentation essentially admits this. The obvious answer is to work in another language; I use Java, where it would be trivial to read a file ...
3
votes
Accepted
How to read *all* input from stdin?
I am not aware of any pure Mathematica solution. The usual way is to read from the stream
stream = OpenRead["!cat"]
You can do this directly with any read ...
3
votes
Accepted
How to get the standard error stream for a ProcessObject?
Use ProcessConnection.
process = StartProcess[$SystemShell]
ProcessConnection[process, "StandardError"]
This returns an <...
3
votes
Explicitly control newline behaviour when writing strings with arbitary encoding
The trouble is it seems when you open BinaryFormat->True it ignores the CharacterEncoding directive. This is a hack writing ...
3
votes
`ReadString` and `StreamPosition` behaving strangely with custom terminators
This is for the moment an incomplete answer, but I gathered lots of insight by using
<<GeneralUtilities`
PrintDefinitions[ReadString]
...
3
votes
Parsing tab delimited file
Once you have your data in the form of a string, Mathematica has very powerful string operations that can parse the data.
I am not claiming that this is the most efficient method but it will work ...
3
votes
Accepted
How do I import a 1 gig text file by only importing the last 3 lines of every 10 line chunk?
Maybe something along these lines would work?
...
3
votes
Accepted
Phase portrait on the sphere
So, one way to do this is to project your vector field (pointwise) onto the vector field that goes around the origin, and then only plot the streams that go through points on the circle—we'll take a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
streams × 105import × 20
plotting × 9
files-and-directories × 8
data × 6
export × 5
parsing × 5
performance-tuning × 4
output-formatting × 4
string-manipulation × 4
vector × 4
scripting × 4
list-manipulation × 3
color × 3
parallelization × 3
memory × 3
input × 3
socket × 3
graphics3d × 2
bugs × 2
programming × 2
dynamic × 2
notebooks × 2
core-language × 2
undocumented × 2