| org.wings.io.Device
All known Subclasses: org.wings.io.OutputStreamDevice, org.wings.io.NullDevice, org.wings.io.CountingDeviceDelegator, org.wings.io.StringBuilderDevice, org.wings.io.ServletDevice, org.wings.io.DeviceBuffer, org.wings.io.CachingDevice, org.wings.io.GZIPCompressingDevice,
Device | public interface Device (Code) | | A general interface for a Output-Device.
A Device is the destination, where the HTML-code is written to. This is
like the 'Graphics' - device in GUI applications.
All the printing methods return the Device itself, to allow simple
chaining:
someDevice.print("foo").print("bar");
Usually, the underlying data sink of a Device would be some OutputStream,
as it finally writes through some socket to the client browser.
The Device, however, offers basically two methods for writing to the
output: with print() and write() like methods. The print() like
methods get character input that has to be converted to a byte-stream
before it actually can be written to the underlying OutputStream, while
the write() like methods directly handle arrays of bytes to do this. So
if possible, try to always use the write() methods, if you can
pre-calculate the byte-representation of the output (if you have some
static Strings, for instance, consider using String.getBytes()).
author: Henner Zeller |
Method Summary | |
void | close() close the Device. | void | flush() Flush this Device. | boolean | isSizePreserving() returns, whether this the size of data put into this device is
the same as comes out. | Device | print(char c) Print a character. | Device | print(char[] c) Print a character array. | Device | print(char[] c, int start, int len) Print len characters from the specified char array starting at offset
off to this Device. | Device | print(String s) Print a String. | Device | print(int i) Print an integer. | Device | print(Object o) | Device | write(int c) Writes the specified byte to this data output stream. | Device | write(byte b) Writes b.length bytes from the specified byte array to this
output stream. | Device | write(byte b, int off, int len) Writes len bytes from the specified byte array starting at offset
off to this Device. |
isSizePreserving | boolean isSizePreserving()(Code) | | returns, whether this the size of data put into this device is
the same as comes out. This is necessary to know if we want to send the
content size: if we know the content size, but this device changes
the size, we must not send it.
'true', if this device leaves the size of the data going throughit, untouched. This is usually true. |
print | Device print(char[] c, int start, int len) throws IOException(Code) | | Print len characters from the specified char array starting at offset
off to this Device.
|
write | Device write(byte b) throws IOException(Code) | | Writes b.length bytes from the specified byte array to this
output stream.
|
write | Device write(byte b, int off, int len) throws IOException(Code) | | Writes len bytes from the specified byte array starting at offset
off to this Device.
|
|
|