braju.com
Java printf & scanf (beta)

com.braju.beta.format
Class FormatString

java.lang.Object
  |
  +--com.braju.beta.format.FormatString

public class FormatString
extends java.lang.Object

If you are using the same format string over and over again, then use this (precompiled) version of a format string to increase speed [JDK1.0.2 compatible]. To compile a printf or scanf format string you should use the method compileFormatString(String) provided in FormatWriter/FormatOutputStream and FormatReader/FormatInputStream respectively. All methods in this class are used internally.


Constructor Summary
FormatString(java.lang.String fmt)
          Creates a FormatString with the string fmt [...].
 
Method Summary
 void addConversion(com.braju.beta.format.Conversion conversion)
          Add a new conversion to the (end of the conversion list).
 void addFixString(java.lang.String fixString)
          Add a new conversion to the (end of the fix string list).
 com.braju.beta.format.Conversion firstConversion()
          Move to the first conversion and return it [...].
 java.lang.String firstFixString()
          Move to the first fix string and return it [...].
 int getNbrOfParametersNeeded()
          Return the number of parameters all the conversions will use.
 boolean hasMoreConversions()
          Check if there is another conversion available [...].
 boolean hasMoreFixStrings()
          Check if there is another fix string available [...].
 int length()
          Return the length of the format string.
 com.braju.beta.format.Conversion nextConversion()
          Return the next conversion.
 java.lang.String nextFixString()
          Return the next fixed string.
 void reset()
          Move the position to the beginning of the format string.
 int size()
          Return the (current) number of conversions added.
 java.lang.String toDebugString()
          Return a string that describes the format string in a short handy format.
 java.lang.String toString()
          Return the format string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormatString

public FormatString(java.lang.String fmt)
Creates a FormatString with the string fmt [...]. No parsing/scanning of the string is made.
Method Detail

reset

public void reset()
Move the position to the beginning of the format string.

hasMoreConversions

public boolean hasMoreConversions()
Check if there is another conversion available [...]. Returns true if there is, otherwise false.

firstConversion

public com.braju.beta.format.Conversion firstConversion()
Move to the first conversion and return it [...]. The same conversion will be returned by nextConversion() next time it is called.

nextConversion

public com.braju.beta.format.Conversion nextConversion()
Return the next conversion.

hasMoreFixStrings

public boolean hasMoreFixStrings()
Check if there is another fix string available [...]. Returns true if there is, otherwise false.

firstFixString

public java.lang.String firstFixString()
Move to the first fix string and return it [...]. The same string will be returned by nextFixString() next time it is called.

nextFixString

public java.lang.String nextFixString()
Return the next fixed string.

addConversion

public void addConversion(com.braju.beta.format.Conversion conversion)
Add a new conversion to the (end of the conversion list).

addFixString

public void addFixString(java.lang.String fixString)
Add a new conversion to the (end of the fix string list).

size

public int size()
Return the (current) number of conversions added.

getNbrOfParametersNeeded

public int getNbrOfParametersNeeded()
Return the number of parameters all the conversions will use.

length

public int length()
Return the length of the format string.

toString

public java.lang.String toString()
Return the format string.
Overrides:
toString in class java.lang.Object

toDebugString

public java.lang.String toDebugString()
Return a string that describes the format string in a short handy format. [...]. For debug purposes only.

braju.com
Java printf & scanf (beta)

Copyright 1997-2000, Henrik Bengtsson.