Boundary I/O Streams Released!

New Java library for working with boundary I/O streams was released.
This library provides classes for processing multiple streams withing a single stream bounded by a specific boundary content.
Let's take a deeper look at its functionality...

First of all, put the Maven dependency into your pom.xml:


Consider a simple use-case: a files streaming service into the stdout.

public class FileStreamService {

    public static void main(String[] args) throws IOException {
        try (BoundaryOutputStream bos = new BoundaryOutputStream(System.out)) {

            for (String filename : args) {
                try (InputStream is = new FileInputStream(filename)) {

          , bos);  // see
                    bos.boundary();                               // separate the stream with the boundary

When you run the service from the command line

java FileStreamService /data/text1.txt /data/text2.txt 

You get something similar like:

Content of the text1.txt-----StreamBoundary-----Content of the text2.txt-----StreamBoundary----- 

Notice that the class BoundaryOutputStream is nothing more than a convenient class, you don't need this class to create such a stream with standard Java I/O classes.

Reading a Multiple Stream 

For reading a multiple stream you can use the class BoundaryInputStream direct or wrap it into a convenient iterable class IterableBoundaryInputStream. We show the second approach:

InputStream in = callFileStreamingService();

try (BoundaryInputStream bis = new BoundaryInputStream(in)) {
    IterableBoundaryInputStream ibis = new IterableBoundaryInputStream(bis);

    for (InputStream is : ibis) {                
        // do something with the stream

The method callFileStreamingService calls the service above and returns its stream as the input for the BoundaryInputStream.

More details at

Happy streaming!