Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.3)

Part Number E41849-02

weblogic.servlet.logging
Class FormatStringBuffer

java.lang.Object
  extended by weblogic.servlet.logging.FormatStringBuffer

public final class FormatStringBuffer
extends Object

This class is very similar to the StringBuffer of the JDK. However since that class if final and you cannot extend it, this class exists. It is primarly written with a couple of convience methods for handling nulls and appending log format dahses (CLF and ELF use both of these as place holders in the log file for null fields. It also tries to pay attention to not generating strings, same as the StringBuffer


Constructor Summary
FormatStringBuffer()
          Constructs a FormatStringBuffer with the initial capacity of 128 bytes
FormatStringBuffer(int capacity)
          Constructs a FormatStringBuffer with the initial capacity specified by the capacity argument.
 
Method Summary
 FormatStringBuffer append(byte b)
          Appends the byte argument to this string buffer.
 FormatStringBuffer append(byte[] b)
          Appends the byte[] argument to this string buffer.
 FormatStringBuffer append(byte[] b, int off, int len)
           
 FormatStringBuffer append(char ch)
          Appends the chars assuming single bytes.
 FormatStringBuffer append(int i)
           
 FormatStringBuffer append(String s)
          Appends the string argument to this string buffer.
 FormatStringBuffer appendDate()
           
 FormatStringBuffer appendMonth(int number)
           
 FormatStringBuffer appendQuotedValueOrDash(String value)
          Appends the string argument with quotes or a dash to the string buffer.
 FormatStringBuffer appendSpaceDashSpace()
          Appends " - "
 FormatStringBuffer appendStatusCode(int number)
          Appends the Staus code to the string buffer.
 FormatStringBuffer appendTime()
           
 FormatStringBuffer appendTwoDigits(int number)
          Appends two digits to the string buffer.
 FormatStringBuffer appendValueOrDash(String value)
          Appends the string argument or a dash if null to the string buffer.
 FormatStringBuffer appendValueOrEmpty(String val)
          Appends the string representation of the string argument or nothing if null to this string buffer.
 FormatStringBuffer appendYear(int yearMinus1900)
           
 byte[] getBytes()
           
 void setLogMillis(boolean logMs)
           
 void setUseGMT(boolean useGMT)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatStringBuffer

public FormatStringBuffer()
Constructs a FormatStringBuffer with the initial capacity of 128 bytes


FormatStringBuffer

public FormatStringBuffer(int capacity)
Constructs a FormatStringBuffer with the initial capacity specified by the capacity argument.

Method Detail

setUseGMT

public void setUseGMT(boolean useGMT)

setLogMillis

public void setLogMillis(boolean logMs)

append

public FormatStringBuffer append(String s)
Appends the string argument to this string buffer.


append

public FormatStringBuffer append(int i)

append

public FormatStringBuffer append(byte b)
Appends the byte argument to this string buffer.


append

public FormatStringBuffer append(byte[] b)
Appends the byte[] argument to this string buffer.


append

public FormatStringBuffer append(byte[] b,
                                 int off,
                                 int len)

appendValueOrEmpty

public FormatStringBuffer appendValueOrEmpty(String val)
Appends the string representation of the string argument or nothing if null to this string buffer.


appendTwoDigits

public FormatStringBuffer appendTwoDigits(int number)
Appends two digits to the string buffer.


appendValueOrDash

public FormatStringBuffer appendValueOrDash(String value)
Appends the string argument or a dash if null to the string buffer. This is the safest most usefuly API for the custom loggers to use


append

public FormatStringBuffer append(char ch)
Appends the chars assuming single bytes. Shouldn't be used for urls etc


appendSpaceDashSpace

public FormatStringBuffer appendSpaceDashSpace()
Appends " - "


appendQuotedValueOrDash

public FormatStringBuffer appendQuotedValueOrDash(String value)
Appends the string argument with quotes or a dash to the string buffer.


appendStatusCode

public FormatStringBuffer appendStatusCode(int number)
Appends the Staus code to the string buffer.


getBytes

public byte[] getBytes()

size

public int size()

appendMonth

public FormatStringBuffer appendMonth(int number)

appendYear

public FormatStringBuffer appendYear(int yearMinus1900)

appendDate

public FormatStringBuffer appendDate()

appendTime

public FormatStringBuffer appendTime()

Copyright 1996, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.3)

Part Number E41849-02