Class SyslogWriter

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

    public class SyslogWriter
    extends java.io.Writer
    SyslogWriter is a wrapper around the java.net.DatagramSocket class so that it behaves like a java.io.Writer.
    Since:
    0.7.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.net.InetAddress address  
      private java.net.DatagramSocket ds  
      private int port  
      (package private) int SYSLOG_PORT  
      (package private) static java.lang.String syslogHost
      Deprecated. 
      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      SyslogWriter​(java.lang.String syslogHost)
      Constructs a new instance of SyslogWriter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      void write​(char[] buf, int off, int len)  
      void write​(java.lang.String string)  
      • Methods inherited from class java.io.Writer

        append, append, append, nullWriter, write, write, write
      • Methods inherited from class java.lang.Object

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

      • syslogHost

        static java.lang.String syslogHost
        Deprecated.
        Host string from last constructed SyslogWriter.
      • address

        private java.net.InetAddress address
      • port

        private final int port
      • ds

        private java.net.DatagramSocket ds
    • Constructor Detail

      • SyslogWriter

        public SyslogWriter​(java.lang.String syslogHost)
        Constructs a new instance of SyslogWriter.
        Parameters:
        syslogHost - host name, may not be null. A port may be specified by following the name or IPv4 literal address with a colon and a decimal port number. To specify a port with an IPv6 address, enclose the IPv6 address in square brackets before appending the colon and decimal port number.
    • Method Detail

      • write

        public void write​(char[] buf,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(java.lang.String string)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • flush

        public void flush()
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in class java.io.Writer
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Writer