Class DatagramPacketOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class DatagramPacketOutputStream
    extends OutputStream
    Provides an OutputStream on top of a DatagramPacket.

    The flush() method must be invoked prior to sending the DatagramPacket.
    The close() method must be invoked after sending the DatagramPacket; the OutputStream will remain open, but will have reset to the beginning of the packet buffer.

    Author:
    cp 2001.01.05
    • Constructor Detail

      • DatagramPacketOutputStream

        public DatagramPacketOutputStream​(DatagramPacket packet)
    • Method Detail

      • write

        public void write​(byte[] abSrc,
                          int ofSrc,
                          int cbCopy)
                   throws IOException
        Writes len bytes from the specified byte array starting at offset off to this output stream.
        Overrides:
        write in class OutputStream
        Throws:
        IOException
      • close

        public void close()
        Closes this output stream and releases any system resources associated with this stream.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Overrides:
        close in class OutputStream
      • reset

        public void reset()
        Reset the output stream back to the beginning of the buffer.