FileDocCategorySizeDatePackage
OutputStreamTarget.javaAPI DocAndroid 5.1 API1904Thu Mar 12 22:22:30 GMT 2015android.filterpacks.base

OutputStreamTarget

public class OutputStreamTarget extends android.filterfw.core.Filter
hide

Fields Summary
private OutputStream
mOutputStream
Constructors Summary
public OutputStreamTarget(String name)

        super(name);
    
Methods Summary
public voidprocess(android.filterfw.core.FilterContext context)

        Frame input = pullInput("data");
        ByteBuffer data;

        if (input.getFormat().getObjectClass() == String.class) {
            String stringVal = (String)input.getObjectValue();
            data = ByteBuffer.wrap(stringVal.getBytes());
        } else {
            data = input.getData();
        }
        try {
            mOutputStream.write(data.array(), 0, data.limit());
            mOutputStream.flush();
        } catch (IOException exception) {
            throw new RuntimeException(
                "OutputStreamTarget: Could not write to stream: " + exception.getMessage() + "!");
        }
    
public voidsetupPorts()

        addInputPort("data");