Safe to have multiple processes writing to the same file at the same time? [CentOs 6, ext4]

What you’re doing seems perfectly OK, provided you’re using the POSIX “raw” IO syscalls such as read(), write(), lseek() and so forth. If you use C stdio (fread(), fwrite() and friends) or some other language runtime library which has its own userspace buffering, then the answer by “Tilo” is relevant, in that due to the … Read more

Memory Stream in Java

ByteArrayInputStream and ByteArrayOutputStream is what you are looking for. These are implementations of the interfaces InputStream and OutputStream that read from and write to a byte array in memory. For ByteArrayOutputStream, the array will grow automatically as you write data to the stream.