net.sf.filePiper.processors.CopyProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of file-piper Show documentation
Show all versions of file-piper Show documentation
This project is a GUI utility for processing files. It allows selecting a set of source files and a pipeline
of processes to apply onto those files. The applications shows in a nice-looking user interface where you can
define profiles for your repetitive tasks.
It provides pre-defined processors doing usual file manipulation tasks like: Copy, Head, Tail, Chunk, Search, Replace, Zip, Unzip...
But the biggest value of this file processor tool is the ability to add easily custom file processors written in java.
The newest version!
package net.sf.filePiper.processors;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import net.sf.filePiper.model.FileProcessorEnvironment;
import net.sf.filePiper.model.OneToOneByteFileProcessor;
/**
* Processor that simply copy the input stream to the ouput stream without content modification.
*
* @author berol
*/
public class CopyProcessor extends OneToOneByteFileProcessor {
public String getProcessorName() {
return "Copy";
}
public String getProposedNameSuffix() {
return "copy";
}
public String getProcessorDescription() {
return "Copy input file to ouput";
}
@Override
public void process(InputStream is, OutputStream os, FileProcessorEnvironment env) throws IOException {
byte[] buffer = new byte[1024];
int readCount;
while (((readCount = is.read(buffer)) >= 0) && env.shouldContinue()) {
os.write(buffer, 0, readCount);
bytesProcessed(readCount);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy