Class PropertiesWithComments

java.lang.Object
net.shibboleth.idp.installer.PropertiesWithComments

public final class PropertiesWithComments extends Object
A package which is similar to Properties, but allows comments to be preserved. We use the Properties package to parse the non-comment lines.
  • Field Details

  • Constructor Details

    • PropertiesWithComments

      public PropertiesWithComments()
      Legacy Constructor.
    • PropertiesWithComments

      public PropertiesWithComments(@Nonnull Set<String> unreplacable)
      Constructor.
      Parameters:
      unreplacable - names to warn on.
  • Method Details

    • addCommentedProperty

      private void addCommentedProperty(@Nonnull @NotEmpty String line, boolean isComment) throws IOException
      Add a property, either as a key/value pair or as a key/comment pair.
      Parameters:
      line - what to look at
      isComment - whether this is a comment or not.
      Throws:
      IOException - when badness happens.
    • loadNameReplacement

      public void loadNameReplacement(InputStream input) throws IOException
      Read the name replacement data.
      Parameters:
      input - what to read
      Throws:
      IOException - if readline fails
    • load

      public void load(InputStream input) throws IOException
      Read the input stream into our structures.
      Parameters:
      input - what to read
      Throws:
      IOException - if readline fails
    • store

      public void store(OutputStream output) throws IOException
      Put the output to the supplied stream.
      Parameters:
      output - where to write
      Throws:
      IOException - is the write fails
    • replaceProperties

      public void replaceProperties(Properties replacements)
      Perform a mass replacement from the supplied Properties.
      Parameters:
      replacements - what to replace.
    • replaceProperty

      public boolean replaceProperty(String propName, String newPropValue)
      Replace the supplied property or stuff it at the bottom of the list.
      Parameters:
      propName - the name of the property to replace
      newPropValue - the value to replace
      Returns:
      true if the property was replaced false if it was added
    • addComment

      public void addComment(String what)
      Append a comment to the list.
      Parameters:
      what - what to add