Class ValidatingObjectInputStream.Builder

All Implemented Interfaces:
IOSupplier<ValidatingObjectInputStream>
Enclosing class:
ValidatingObjectInputStream

public static class ValidatingObjectInputStream.Builder extends AbstractStreamBuilder<ValidatingObjectInputStream,ValidatingObjectInputStream.Builder>
Builds a new ValidatingObjectInputStream.

Using NIO


 ValidatingObjectInputStream s = ValidatingObjectInputStream.builder()
   .setPath(Paths.get("MyFile.ser"))
   .get();
 

Using IO


 ValidatingObjectInputStream s = ValidatingObjectInputStream.builder()
   .setFile(new File("MyFile.ser"))
   .get();
 
Since:
2.18.0
See Also:
  • Constructor Details

  • Method Details

    • accept

      public ValidatingObjectInputStream.Builder accept(Class<?>... classes)
      Accepts the specified classes for deserialization, unless they are otherwise rejected.
      Parameters:
      classes - Classes to accept
      Returns:
      this object
      Since:
      2.18.0
    • accept

      Accepts class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.
      Parameters:
      matcher - a class name matcher to accept objects.
      Returns:
      this instance.
      Since:
      2.18.0
    • accept

      Accepts class names that match the supplied pattern for deserialization, unless they are otherwise rejected.
      Parameters:
      pattern - a Pattern for compiled regular expression.
      Returns:
      this instance.
      Since:
      2.18.0
    • accept

      public ValidatingObjectInputStream.Builder accept(String... patterns)
      Accepts the wildcard specified classes for deserialization, unless they are otherwise rejected.
      Parameters:
      patterns - Wildcard file name patterns as defined by FilenameUtils.wildcardMatch
      Returns:
      this instance.
      Since:
      2.18.0
    • get

      Description copied from interface: IOSupplier
      Gets a result.
      Returns:
      a result.
      Throws:
      IOException - if an I/O error occurs.
    • getPredicate

      public ObjectStreamClassPredicate getPredicate()
      Gets the predicate.
      Returns:
      the predicate.
      Since:
      2.18.0
    • reject

      public ValidatingObjectInputStream.Builder reject(Class<?>... classes)
      Rejects the specified classes for deserialization, even if they are otherwise accepted.
      Parameters:
      classes - Classes to reject
      Returns:
      this instance.
      Since:
      2.18.0
    • reject

      Rejects class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.
      Parameters:
      matcher - the matcher to use
      Returns:
      this instance.
      Since:
      2.18.0
    • reject

      Rejects class names that match the supplied pattern for deserialization, even if they are otherwise accepted.
      Parameters:
      pattern - standard Java regexp
      Returns:
      this instance.
      Since:
      2.18.0
    • reject

      public ValidatingObjectInputStream.Builder reject(String... patterns)
      Rejects the wildcard specified classes for deserialization, even if they are otherwise accepted.
      Parameters:
      patterns - Wildcard file name patterns as defined by FilenameUtils.wildcardMatch
      Returns:
      this instance.
      Since:
      2.18.0
    • setPredicate

      Sets the predicate, null resets to an empty new ObjectStreamClassPredicate.
      Parameters:
      predicate - the predicate.
      Returns:
      this instance.
      Since:
      2.18.0