Class ScanfFormat

java.lang.Object
org.cip4.jdflib.cformat.ScanfFormat

@Deprecated public class ScanfFormat extends Object
Deprecated.
Format object for scanning input in the same way as the C scanf methodName.

A scanf style format string is specified in the constructor. Once instantiated, objects of this class may be passed as arguments to the scan methods of the ScanfReader class.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Constructs a ScanfFormat class from a format string.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    set(String fmt)
    Deprecated.
    Sets the contents of the object according to the information provided in the format string.

    Methods inherited from class java.lang.Object

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

    • type

      public int type
      Deprecated.
  • Constructor Details

    • ScanfFormat

      public ScanfFormat(String fmt)
      Deprecated.
      Constructs a ScanfFormat class from a format string. The structure of the format string is described in the documentation for the set method.
      Parameters:
      fmt - Format string
      Throws:
      IllegalArgumentException - Malformed format string
      See Also:
  • Method Details

    • set

      public void set(String fmt)
      Deprecated.
      Sets the contents of the object according to the information provided in the format string.

      The format string describes what input to expect for a ScanfReader, and its form closely matches that for the C scanf methodName, expect that multiple conversions cannot be specified.

      A conversion sequence is introduced by the '%' character; valid conversion sequences are described below. Other characters may appear in the format string. A white space character requests a match of any amount of white space, including none. Other characters request an exact match of themselves. The character sequence "%%" requests a match of the '%' character.

      The '%' character introducing a conversion sequence may be followed by an unsigned decimal integer indicating the field width, which is the maximum number of characters used for a particular conversion. Field widths must be greater than 0.

      The optional field width is followed by one of the following conversion characters, which specifies the primitive type to be scanned:

      f
      floating point (double).
      d
      signed decimal integer (long or int).
      o
      unsigned octal integer (long or int), formed from the digits [0-7].
      x
      unsigned hex integer (long or int), formed from the characters [0-9a-fA-F].
      i
      signed integer (long or int). If the digit sequence begins with "0x", then a hex value is scanned; if the digit sequence begins with "0", then an octal value is scanned; and otherwise a decimal value is scanned.
      c
      character (char).
      [
      matches any character in the sequence specified between the '[' and a closing ']', unless the first character in the sequence is a '^', in which case any character is matched which does not appear in the following sequence. To include ']' in the sequence, it should be placed immediately after the initial '[' or '[^'. The character '-' is also special; if it appears between any two characters in the sequence, then all characters within the numeric range specified by the two characters are implicitly incorported into the sequence. Consecutive '-' characters are not permitted in the sequence. A lone '-' character may be specified by placing it at the end of the sequence, before the closing ']'.
      s
      matches a string delimited by white space.
      Parameters:
      fmt - Format string
      Throws:
      IllegalArgumentException - Malformed format string
      See Also: