org.joda.time.format
Class FormatUtils

java.lang.Object
  extended by org.joda.time.format.FormatUtils

public class FormatUtils
extends Object

Utility methods used by formatters.

FormatUtils is thread-safe and immutable.

Since:
1.0

Method Summary
static void appendPaddedInteger(Appendable appenadble, int value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given appendable.
static void appendPaddedInteger(Appendable appendable, long value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.
static void appendPaddedInteger(StringBuffer buf, int value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.
static void appendPaddedInteger(StringBuffer buf, long value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.
static void appendUnpaddedInteger(Appendable appendable, int value)
          Converts an integer to a string, and appends it to the given appendable.
static void appendUnpaddedInteger(Appendable appendable, long value)
          Converts an integer to a string, and appends it to the given appendable.
static void appendUnpaddedInteger(StringBuffer buf, int value)
          Converts an integer to a string, and appends it to the given buffer.
static void appendUnpaddedInteger(StringBuffer buf, long value)
          Converts an integer to a string, and appends it to the given buffer.
static int calculateDigitCount(long value)
          Calculates the number of decimal digits for the given value, including the sign.
static void writePaddedInteger(Writer out, int value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and writes it to the given writer.
static void writePaddedInteger(Writer out, long value, int size)
          Converts an integer to a string, prepended with a variable amount of '0' pad characters, and writes it to the given writer.
static void writeUnpaddedInteger(Writer out, int value)
          Converts an integer to a string, and writes it to the given writer.
static void writeUnpaddedInteger(Writer out, long value)
          Converts an integer to a string, and writes it to the given writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

appendPaddedInteger

public static void appendPaddedInteger(StringBuffer buf,
                                       int value,
                                       int size)
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.

This method is optimized for converting small values to strings.

Parameters:
buf - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append

appendPaddedInteger

public static void appendPaddedInteger(Appendable appenadble,
                                       int value,
                                       int size)
                                throws IOException
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given appendable.

This method is optimized for converting small values to strings.

Parameters:
appenadble - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append
Throws:
IOException
Since:
2.4

appendPaddedInteger

public static void appendPaddedInteger(StringBuffer buf,
                                       long value,
                                       int size)
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.

This method is optimized for converting small values to strings.

Parameters:
buf - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append

appendPaddedInteger

public static void appendPaddedInteger(Appendable appendable,
                                       long value,
                                       int size)
                                throws IOException
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.

This method is optimized for converting small values to strings.

Parameters:
appendable - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append
Throws:
IOException
Since:
2.4

writePaddedInteger

public static void writePaddedInteger(Writer out,
                                      int value,
                                      int size)
                               throws IOException
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and writes it to the given writer.

This method is optimized for converting small values to strings.

Parameters:
out - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append
Throws:
IOException

writePaddedInteger

public static void writePaddedInteger(Writer out,
                                      long value,
                                      int size)
                               throws IOException
Converts an integer to a string, prepended with a variable amount of '0' pad characters, and writes it to the given writer.

This method is optimized for converting small values to strings.

Parameters:
out - receives integer converted to a string
value - value to convert to a string
size - minimum amount of digits to append
Throws:
IOException

appendUnpaddedInteger

public static void appendUnpaddedInteger(StringBuffer buf,
                                         int value)
Converts an integer to a string, and appends it to the given buffer.

This method is optimized for converting small values to strings.

Parameters:
buf - receives integer converted to a string
value - value to convert to a string

appendUnpaddedInteger

public static void appendUnpaddedInteger(Appendable appendable,
                                         int value)
                                  throws IOException
Converts an integer to a string, and appends it to the given appendable.

This method is optimized for converting small values to strings.

Parameters:
appendable - receives integer converted to a string
value - value to convert to a string
Throws:
IOException
Since:
2.4

appendUnpaddedInteger

public static void appendUnpaddedInteger(StringBuffer buf,
                                         long value)
Converts an integer to a string, and appends it to the given buffer.

This method is optimized for converting small values to strings.

Parameters:
buf - receives integer converted to a string
value - value to convert to a string

appendUnpaddedInteger

public static void appendUnpaddedInteger(Appendable appendable,
                                         long value)
                                  throws IOException
Converts an integer to a string, and appends it to the given appendable.

This method is optimized for converting small values to strings.

Parameters:
appendable - receives integer converted to a string
value - value to convert to a string
Throws:
IOException

writeUnpaddedInteger

public static void writeUnpaddedInteger(Writer out,
                                        int value)
                                 throws IOException
Converts an integer to a string, and writes it to the given writer.

This method is optimized for converting small values to strings.

Parameters:
out - receives integer converted to a string
value - value to convert to a string
Throws:
IOException

writeUnpaddedInteger

public static void writeUnpaddedInteger(Writer out,
                                        long value)
                                 throws IOException
Converts an integer to a string, and writes it to the given writer.

This method is optimized for converting small values to strings.

Parameters:
out - receives integer converted to a string
value - value to convert to a string
Throws:
IOException

calculateDigitCount

public static int calculateDigitCount(long value)
Calculates the number of decimal digits for the given value, including the sign.



Copyright © 2002–2014 Joda.org. All rights reserved.