com.javanut.pronghorn.pipe.util.MutableCharReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pronghorn-pipes Show documentation
Show all versions of pronghorn-pipes Show documentation
Ring buffer based queuing utility for applications that require high performance and/or a small
footprint. Well suited for embedded and stream based processing.
package com.javanut.pronghorn.pipe.util;
import java.io.IOException;
import java.io.Reader;
public class MutableCharReader extends Reader implements Appendable {
private final StringBuilder buffer = new StringBuilder();
@Override
public Appendable append(CharSequence source) throws IOException {
buffer.append(source);
return this;
}
@Override
public Appendable append(char source) throws IOException {
buffer.append(source);
return this;
}
@Override
public Appendable append(CharSequence source, int start, int end) throws IOException {
buffer.append(source, start, end);
return this;
}
public void clear() {
buffer.setLength(0);
}
@Override
public void close() throws IOException {
buffer.setLength(0);
}
@Override
public int read(char[] target, int off, int len) throws IOException {
int j = 0;
int copyLen = Math.min(buffer.length(), len);
for(int i=off; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy