Abstracted the HTTP server with TCP Network classes and added an SSDP service
This commit is contained in:
parent
b3ad292ff9
commit
45f514fc27
25 changed files with 1645 additions and 688 deletions
45
src/zutil/wrapper/StringOutputStream.java
Normal file
45
src/zutil/wrapper/StringOutputStream.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package zutil.wrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
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 StringBuffer buffer;
|
||||
|
||||
/**
|
||||
* Creates an new instance of this class
|
||||
*/
|
||||
public StringOutputStream(){
|
||||
buffer = new StringBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
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) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the String with the data
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue