Enum Class RecordJar

java.lang.Object
java.lang.Enum<RecordJar>
software.visionary.recordJar.RecordJar
All Implemented Interfaces:
Serializable, Comparable<RecordJar>, Constable

public enum RecordJar extends Enum<RecordJar>

Record-Jar Format

Cookie-jar record separators combine well with the RFC 822 metaformat for records, yielding a format we’ll call ‘record-jar’. If you need a textual format that will support multiple records with a variable repertoire of explicit fieldnames, one of the least surprising and human-friendliest ways to do it would look like Example 5.4.

             
            Planet: Mercury
            Orbital-Radius: 57,910,000 km
            Diameter: 4,880 km
            Mass: 3.30e23 kg
            %%
            Planet: Venus
            Orbital-Radius: 108,200,000 km
            Diameter: 12,103.6 km
            Mass: 4.869e24 kg
            %%
            Planet: Earth
            Orbital-Radius: 149,600,000 km
            Diameter: 12,756.3 km
            Mass: 5.972e24 kg
            Moons: Luna
              
         
Example 5.4. Basic data for three planets in a record-jar format.

Of course, the record delimiter could be a blank line, but a line consisting of "%%\n" is more explicit and less likely to be introduced by accident during editing (two printable characters are better than one because it can’t be generated by a single-character typo). In a format like this it is good practice to simply ignore blank lines.

The Art of Unix Programming
Eric S Raymond
  • Enum Constant Details

    • INSTANCE

      public static final RecordJar INSTANCE
      SINGLETON.
  • Method Details

    • values

      public static RecordJar[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RecordJar valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • from

      public Records from(ByteBuffer src, Charset charset)
      Reads Records from ByteBuffer.
      Parameters:
      src - should not be null
      charset - should not be null
      Returns:
      the records contained, never null
    • to

      public ByteBuffer to(Records records, Charset charset)
      Writes Records as String using CookieJar.DOUBLE delimiter.
      Parameters:
      records - should not be null
      charset - should not be null
      Returns:
      never null