Class BodyObfuscator

java.lang.Object
com.onlinepayments.logging.BodyObfuscator

public final class BodyObfuscator extends Object
A class that can be used to obfuscate properties in JSON bodies. Thread-safe if all its obfuscation rules are.
  • Method Details

    • obfuscateBody

      public String obfuscateBody(CharSequence body)
      Obfuscates the given body as necessary.
    • obfuscateBody

      public String obfuscateBody(InputStream bodyStream, Charset charset) throws IOException
      Obfuscates the body from the given stream as necessary.
      Parameters:
      charset - The charset to use to read the body input stream.
      Throws:
      IOException
    • obfuscateBody

      public String obfuscateBody(Reader bodyStream) throws IOException
      Obfuscates the body from the given stream as necessary.
      Throws:
      IOException
    • custom

      public static BodyObfuscator.Builder custom()
      Returns a builder to create custom body obfuscators. This builder will contain some pre-defined obfuscation rules. These cannot be removed, but replacing them is possible.
    • defaultObfuscator

      public static BodyObfuscator defaultObfuscator()
      Returns a default body obfuscator. The result will be equivalent to calling custom().build().