Class SyslogOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class SyslogOutputStream
    extends java.io.OutputStream
    SyslogOutputStream is a wrapper around the DatagramSocket class so that it behaves like an OutputStream.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.net.InetAddress address  
      private java.io.ByteArrayOutputStream baos  
      private java.net.DatagramSocket ds  
      private static int MAX_LEN
      The maximum length after which we discard the existing string buffer and start anew.
      private int port  
    • Constructor Summary

      Constructors 
      Constructor Description
      SyslogOutputStream​(java.lang.String syslogHost, int port)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      int getPort()  
      (package private) int getSendBufferSize()  
      void write​(byte[] byteArray, int offset, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

        write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_LEN

        private static final int MAX_LEN
        The maximum length after which we discard the existing string buffer and start anew.
        See Also:
        Constant Field Values
      • address

        private java.net.InetAddress address
      • ds

        private java.net.DatagramSocket ds
      • baos

        private java.io.ByteArrayOutputStream baos
      • port

        private final int port
    • Constructor Detail

      • SyslogOutputStream

        public SyslogOutputStream​(java.lang.String syslogHost,
                                  int port)
                           throws java.net.UnknownHostException,
                                  java.net.SocketException
        Throws:
        java.net.UnknownHostException
        java.net.SocketException
    • Method Detail

      • write

        public void write​(byte[] byteArray,
                          int offset,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
      • getPort

        public int getPort()
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • getSendBufferSize

        int getSendBufferSize()
                       throws java.net.SocketException
        Throws:
        java.net.SocketException