Posts Tagged ‘I/O’

Write and read binary files in C++

To write the EDDI compiler, I had to write and read binary files. Writing text files is really easy in C++, directly using the < < operator on the stream, but writing binary is a little harder and, I must say, a lot less elegant.

First, to write to a binary file, we have to use the binary flag when we create the file …

Java File Copy Benchmark Updates (once again)

I’ve made another updates to my file copy benchmark.
First of all, I used my little utility class to automatically create the graphs. The graph are a little less clean, but I spare a lot of time not creating them myself.
Then, I’ve also made some corrections on the code :

I”ve used a buffer size of 8192 instead of 4096
I’ve made some corrections using the channels …

Java File Copy Benchmarks Update

I’ve made an update of my benchmark about file copy methods in Java. I’ve been asked for new informations about this benchmark and for new test, so I’ve included more results and informations.
This new version include two new complete benchmarks :

Benchmark on the same disk (Ext4)
Benchmark between two disks (Ext4 -> Ext4)

And of course the old benchmark is always here : Benchmark between two …

File copy in Java – Benchmark

Yesterday I wondered if the copyFile method in JTheque Utils was the best method or if I need to change. So I decided to do a benchmark.
So I searched all the methods to copy a File in Java, even the bad methods and found 5 methods :

Native Copy : Make the copy using the cp executable of Linux
Naive Streams Copy : Open two streams, …

Java 7 : New I/O features (Asynchronous operations, multicasting, random access) with JSR 203 (NIO.2)

Like I’ve said in other post, we will have a new API to access File System in Java 7, but we’ll have several others new features in NIO.2 that I’ve not covered
So I’ll try to cover them in that post. Indeed the JSR 203 (also known as NIO.2) add several new classes that improve I/O code.
In this post I cover the following features :

SeekableByteChannel …

NIO.2 : The new Path API in Java 7

In Java 7 we’ll see a new API to manipulate file paths. This is part of the NIO.2 API.
Instead of using the class java.io.File to manipulate a file of the file system of the computer we will now use the java.nio.file.Path class to manipulate a file in any file system (FileSystem). This FileSystem can use any storage place (FileStorage). To support several implementations, this …