com.github.powerlibraries.io.builder.targets.ByteArrayTarget Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iopower Show documentation
Show all versions of iopower Show documentation
Power Libraries is a small project to collect some repeatedly needed or otherwise useful Java 8 classes in a collection of tiny libraries.
IO Power is the first and really tiny library of the Power Libraries. It contains some simple helper method for opening Input- and Outputstreams. The main purpose of IO Power is to make opening streams, readers and writers less cluttered and simple to understand.
The newest version!
package com.github.powerlibraries.io.builder.targets;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* This class represents a ByteArrayOutputStream as the final element in the chain.
* @author Manuel Hegner
*/
public class ByteArrayTarget implements Target {
private ByteArrayOutputStream lastStream;
public ByteArrayOutputStream getLastStream() {
return lastStream;
}
@Override
public OutputStream openStream() throws IOException {
this.lastStream=new ByteArrayOutputStream();
return lastStream;
}
}