/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.IllegalArgumentException
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.lang.System
 *  java.util.Calendar
 *  java.util.Date
 *  java.util.TimeZone
 */
package com.google.code.microlog4android.appender;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class SyslogMessage {
    public static final int DEFAULT_MESSAGE_BUFFER_SIZE = 128;
    public static final int DEFAULT_SYSLOG_PORT = 514;
    public static final String DEFAULT_SYSLOG_TAG = "microlog";
    public static final byte FACILITY_KERNAL_MESSAGE = 0;
    public static final byte FACILITY_LOCAL_USE_0 = 16;
    public static final byte FACILITY_LOCAL_USE_1 = 17;
    public static final byte FACILITY_LOCAL_USE_2 = 18;
    public static final byte FACILITY_LOCAL_USE_3 = 19;
    public static final byte FACILITY_LOCAL_USE_4 = 20;
    public static final byte FACILITY_LOCAL_USE_5 = 21;
    public static final byte FACILITY_LOCAL_USE_6 = 22;
    public static final byte FACILITY_LOCAL_USE_7 = 23;
    public static final byte FACILITY_LOG_ALERT = 14;
    public static final byte FACILITY_LOG_AUDIT = 13;
    public static final byte FACILITY_MAIL_SYSTEM = 2;
    public static final byte FACILITY_SECURITY_MESSAGE = 4;
    public static final byte FACILITY_SYSTEM_DAEMONS = 3;
    public static final byte FACILITY_USER_LEVEL_MESSAGE = 1;
    public static final String[] MONTHS = new String[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
    public static final byte SEVERITY_ALERT = 1;
    public static final byte SEVERITY_CRITICAL = 2;
    public static final byte SEVERITY_DEBUG = 7;
    public static final byte SEVERITY_EMERGENCY = 0;
    public static final byte SEVERITY_ERROR = 3;
    public static final byte SEVERITY_INFORMATIONAL = 6;
    public static final byte SEVERITY_NOTICE = 5;
    public static final byte SEVERITY_WARNING = 4;
    public static final int TEN = 10;
    private final Calendar calendar = Calendar.getInstance((TimeZone)TimeZone.getTimeZone((String)"GMT"));
    private byte facility = 1;
    private boolean header;
    private String hostname;
    private final StringBuffer messageStringBuffer = new StringBuffer(128);
    private byte severity = 7;
    String tag;

    public String createMessageData(String string2) {
        this.messageStringBuffer.delete(0, this.messageStringBuffer.length());
        this.messageStringBuffer.append('<');
        int n = 8 * this.facility + this.severity;
        this.messageStringBuffer.append(n);
        this.messageStringBuffer.append('>');
        if (this.header) {
            long l = System.currentTimeMillis();
            this.calendar.setTime(new Date(l));
            this.messageStringBuffer.append(MONTHS[this.calendar.get(2)]);
            this.messageStringBuffer.append(' ');
            int n2 = this.calendar.get(5);
            if (n2 < 10) {
                this.messageStringBuffer.append('0');
            }
            this.messageStringBuffer.append(n2);
            this.messageStringBuffer.append(' ');
            int n3 = this.calendar.get(11);
            if (n3 < 10) {
                this.messageStringBuffer.append('0');
            }
            this.messageStringBuffer.append(n3);
            this.messageStringBuffer.append(':');
            int n4 = this.calendar.get(12);
            if (n4 < 10) {
                this.messageStringBuffer.append('0');
            }
            this.messageStringBuffer.append(n4);
            this.messageStringBuffer.append(':');
            int n5 = this.calendar.get(13);
            if (n5 < 10) {
                this.messageStringBuffer.append('0');
            }
            this.messageStringBuffer.append(n5);
            this.messageStringBuffer.append(' ');
            this.messageStringBuffer.append(this.hostname);
        }
        this.messageStringBuffer.append(' ');
        this.messageStringBuffer.append(this.tag);
        this.messageStringBuffer.append(": ");
        this.messageStringBuffer.append(string2);
        return this.messageStringBuffer.toString();
    }

    public byte getFacility() {
        return this.facility;
    }

    public String getHostname() {
        return this.hostname;
    }

    public void setFacility(byte by) {
        if (by < 0 || by > 23) {
            throw new IllegalArgumentException("Not a valid facility.");
        }
        this.facility = by;
    }

    public void setHeader(boolean bl) {
        this.header = bl;
    }

    public void setHostname(String string2) throws IllegalArgumentException {
        if (string2 == null) {
            throw new IllegalArgumentException("The hostname must not be null.");
        }
        this.hostname = string2;
    }

    public void setSeverity(byte by) throws IllegalArgumentException {
        if (by < 0 || by > 7) {
            throw new IllegalArgumentException("Not a valid severity.");
        }
        this.severity = by;
    }

    public void setTag(String string2) throws IllegalArgumentException {
        if (string2 == null || string2 != null && (string2.length() < 1 || string2.length() > 32)) {
            throw new IllegalArgumentException("The tag must not be null, the length between 1..32");
        }
        this.tag = string2;
    }
}

