moved some files and fixed javadoc
This commit is contained in:
parent
7176c87c08
commit
58a3113819
5 changed files with 147 additions and 20 deletions
48
src/zutil/io/StringOutputStream.java
Normal file
48
src/zutil/io/StringOutputStream.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package zutil.io;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* This class saves all the input data in to an StringBuffer
|
||||
*
|
||||
* @author Ziver
|
||||
*
|
||||
*/
|
||||
public class StringOutputStream extends OutputStream{
|
||||
// The buffer
|
||||
protected StringBuilder buffer;
|
||||
|
||||
/**
|
||||
* Creates an new instance of this class
|
||||
*/
|
||||
public StringOutputStream(){
|
||||
clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
buffer.append( b );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) {
|
||||
buffer.append( new String(b) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) {
|
||||
buffer.append( new String(b, off, len) );
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
buffer = new StringBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the String with the data
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue