Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk.io.j2me.channel
Class ChannelOutputStream

    java.lang.Object
      java.io.OutputStream
          com.sun.squawk.io.j2me.channel.ChannelOutputStream

All Implemented Interfaces:
  DataOutput

    public class ChannelOutputStream

extends OutputStream
implements DataOutput

ChannelOutputStream

Constructor Summary
`ChannelOutputStream(Protocol parent)`

Method Summary
`void` | `close()` Closes this output stream and releases any system resources associated with this stream.
`void` | `flush()` Flushes this output stream and forces any buffered output bytes to be written out.
`void` | `write(byte[] b)` Writes to the output stream all the bytes in array `b`.
`void` | `write(byte[] b, int off, int len)` Writes `len` bytes from the specified byte array starting at offset `off` to this output stream.
`void` | `write(int v)` Writes the specified byte to this output stream.
`void` | `writeBoolean(boolean v)` Writes a `boolean` value to this output stream.
`void` | `writeByte(int v)` Writes out a `byte` to the underlying output stream as a 1-byte value.
`void` | `writeChar(int v)` Writes a `char` value, which is comprised of two bytes, to the output stream.
`void` | `writeChars(String s)` Writes a string to the underlying output stream as a sequence of characters.
`void` | `writeDouble(double v)` Writes a 64 bit double.
`void` | `writeFloat(float v)` Writes a 32 bit float.
`void` | `writeInt(int v)` Writes an `int` value, which is comprised of four bytes, to the output stream.
`void` | `writeLong(long v)` Writes an `long` value, which is comprised of four bytes, to the output stream.
`void` | `writeShort(int v)` Writes two bytes to the output stream to represent the value of the argument.
`void` | `writeUTF(String str)` Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChannelOutputStream

    public ChannelOutputStream(Protocol parent)
                        throws IOException

Throws:
  `IOException`

Method Detail

### flush

    public void flush()
               throws IOException

  Description copied from class: `OutputStream`
  Flushes this output stream and forces any buffered output bytes to be written out. The general contract of `flush` is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

  The `flush` method of `OutputStream` does nothing.

  Overrides:
    `flush` in class `OutputStream`
  Throws:
    `IOException` - if an I/O error occurs.

### close

    public void close()
               throws IOException

  Description copied from class: `OutputStream`
  Closes this output stream and releases any system resources associated with this stream. The general contract of `close` is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

  The `close` method of `OutputStream` does nothing.

  Overrides:
    `close` in class `OutputStream`
  Throws:
    `IOException` - if an I/O error occurs.

### write

    public void write(int v)
               throws IOException

  Description copied from class: `OutputStream`
  Writes the specified byte to this output stream. The general contract for `write` is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument `b`. The 24 high-order bits of `b` are ignored.

  Subclasses of `OutputStream` must provide an implementation for this method.

  Specified by:
    `write` in interface `DataOutput`
  Specified by:
    `write` in class `OutputStream`
  Parameters:
    `v` - the `byte`.
  Throws:
    `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

### writeShort

    public void writeShort(int v)
                    throws IOException

  Description copied from interface: `DataOutput`
  Writes two bytes to the output stream to represent the value of the argument. The byte values to be written, in the order shown, are:

       (byte)(0xff & (v >> 8))
       (byte)(0xff & v)

  The bytes written by this method may be read by the `readShort` method of interface `DataInput`, which will then return a `short` equal to `(short)v`.

  Specified by:
    `writeShort` in interface `DataOutput`
  Parameters:
    `v` - the `short` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### writeChar

    public void writeChar(int v)
                   throws IOException

  Description copied from interface: `DataOutput`
  Writes a `char` value, which is comprised of two bytes, to the output stream. The byte values to be written, in the order shown, are:

       (byte)(0xff & (v >> 8))
       (byte)(0xff & v)

  The bytes written by this method may be read by the `readChar` method of interface `DataInput`, which will then return a `char` equal to `(char)v`.

  Specified by:
    `writeChar` in interface `DataOutput`
  Parameters:
    `v` - the `char` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### writeInt

    public void writeInt(int v)
                  throws IOException

  Description copied from interface: `DataOutput`
  Writes an `int` value, which is comprised of four bytes, to the output stream. The byte values to be written, in the order shown, are:

       (byte)(0xff & (v >> 24))
       (byte)(0xff & (v >> 16))
       (byte)(0xff & (v >>    8))
       (byte)(0xff & v)

  The bytes written by this method may be read by the `readInt` method of interface `DataInput`, which will then return an `int` equal to `v`.

  Specified by:
    `writeInt` in interface `DataOutput`
  Parameters:
    `v` - the `int` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### writeLong

    public void writeLong(long v)
                   throws IOException

  Description copied from interface: `DataOutput`
  Writes an `long` value, which is comprised of four bytes, to the output stream. The byte values to be written, in the order shown, are:

       (byte)(0xff & (v >> 56))
       (byte)(0xff & (v >> 48))
       (byte)(0xff & (v >> 40))
       (byte)(0xff & (v >> 32))
       (byte)(0xff & (v >> 24))
       (byte)(0xff & (v >> 16))
       (byte)(0xff & (v >>  8))
       (byte)(0xff & v)

  The bytes written by this method may be read by the `readLong` method of interface `DataInput`, which will then return a `long` equal to `v`.

  Specified by:
    `writeLong` in interface `DataOutput`
  Parameters:
    `v` - the `long` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws IOException

  Description copied from class: `OutputStream`
  Writes `len` bytes from the specified byte array starting at offset `off` to this output stream. The general contract for `write(b, off, len)` is that some of the bytes in the array `b` are written to the output stream in order; element `b[off]` is the first byte written and `b[off+len-1]` is the last byte written by this operation.

  The `write` method of `OutputStream` calls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation.

  If `b` is `null`, a `NullPointerException` is thrown.

  If `off` is negative, or `len` is negative, or `off+len` is greater than the length of the array `b`, then an `IndexOutOfBoundsException` is thrown.

  Specified by:
    `write` in interface `DataOutput`
  Overrides:
    `write` in class `OutputStream`
  Parameters:
    `b` - the data.
    `off` - the start offset in the data.
    `len` - the number of bytes to write.
  Throws:
    `IOException` - if an I/O error occurs. In particular, an `IOException` is thrown if the output stream is closed.

### write

    public void write(byte[] b)
               throws IOException

  Writes to the output stream all the bytes in array `b`. If `b` is `null`, a `NullPointerException` is thrown. If `b.length` is zero, then no bytes are written. Otherwise, the byte `b[0]` is written first, then `b[1]`, and so on; the last byte written is `b[b.length-1]`.

  Specified by:
    `write` in interface `DataOutput`
  Overrides:
    `write` in class `OutputStream`
  Parameters:
    `b` - the data.
  Throws:
    `IOException` - if an I/O error occurs.
  See Also:
    `OutputStream.write(byte[], int, int)`

### writeByte

    public final void writeByte(int v)
                         throws IOException

  Writes out a `byte` to the underlying output stream as a 1-byte value. If no exception is thrown, the counter `written` is incremented by `1`.

  Specified by:
    `writeByte` in interface `DataOutput`
  Parameters:
    `v` - a `byte` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### writeFloat

    public final void writeFloat(float v)
                          throws IOException

  Writes a 32 bit float.

  Specified by:
    `writeFloat` in interface `DataOutput`
  Parameters:
    `v` - the float value to be written
  Throws:
    `IOException` - if an I/O error occurs.

### writeDouble

    public final void writeDouble(double v)
                           throws IOException

  Writes a 64 bit double.

  Specified by:
    `writeDouble` in interface `DataOutput`
  Parameters:
    `v` - the double value to be written
  Throws:
    `IOException` - if an I/O error occurs.

### writeBoolean

    public void writeBoolean(boolean v)
                      throws IOException

  Writes a `boolean` value to this output stream. If the argument `v` is `true`, the value `(byte)1` is written; if `v` is `false`, the value `(byte)0` is written. The byte written by this method may be read by the `readBoolean` method of interface `DataInput`, which will then return a `boolean` equal to `v`.

  Specified by:
    `writeBoolean` in interface `DataOutput`
  Parameters:
    `v` - the boolean to be written.
  Throws:
    `IOException` - if an I/O error occurs.

### writeChars

    public final void writeChars(String s)
                          throws IOException

  Writes a string to the underlying output stream as a sequence of characters. Each character is written to the data output stream as if by the `writeChar` method. If no exception is thrown, the counter `written` is incremented by twice the length of `s`.

  Specified by:
    `writeChars` in interface `DataOutput`
  Parameters:
    `s` - a `String` value to be written.
  Throws:
    `IOException` - if an I/O error occurs.
  See Also:
    `DataOutputStream.writeChar(int)`

### writeUTF

    public final void writeUTF(String str)
                        throws IOException

  Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

  First, two bytes are written to the output stream as if by the `writeShort` method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for the character. If no exception is thrown, the counter `written` is incremented by the total number of bytes written to the output stream. This will be at least two plus the length of `str`, and at most two plus thrice the length of `str`.

  Specified by:
    `writeUTF` in interface `DataOutput`
  Parameters:
    `str` - a string to be written.
  Throws:
    `IOException` - if an I/O error occurs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"