Class ValidatingObjectInputStream.Builder
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOriginSupplier<T,B>
-
- org.apache.commons.io.build.AbstractStreamBuilder<ValidatingObjectInputStream,ValidatingObjectInputStream.Builder>
-
- org.apache.commons.io.serialization.ValidatingObjectInputStream.Builder
-
- All Implemented Interfaces:
IOSupplier<ValidatingObjectInputStream>
- Enclosing class:
- ValidatingObjectInputStream
public static class ValidatingObjectInputStream.Builder extends AbstractStreamBuilder<ValidatingObjectInputStream,ValidatingObjectInputStream.Builder>
Builds a newValidatingObjectInputStream
.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:
get()
-
-
Constructor Summary
Constructors Constructor Description Builder()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidatingObjectInputStream.Builder
accept(java.lang.Class<?>... classes)
Accepts the specified classes for deserialization, unless they are otherwise rejected.ValidatingObjectInputStream.Builder
accept(java.lang.String... patterns)
Accepts the wildcard specified classes for deserialization, unless they are otherwise rejected.ValidatingObjectInputStream.Builder
accept(java.util.regex.Pattern pattern)
Accepts class names that match the supplied pattern for deserialization, unless they are otherwise rejected.ValidatingObjectInputStream.Builder
accept(ClassNameMatcher matcher)
Accepts class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.ValidatingObjectInputStream
get()
Gets a result.ObjectStreamClassPredicate
getPredicate()
Gets the predicate.ValidatingObjectInputStream.Builder
reject(java.lang.Class<?>... classes)
Rejects the specified classes for deserialization, even if they are otherwise accepted.ValidatingObjectInputStream.Builder
reject(java.lang.String... patterns)
Rejects the wildcard specified classes for deserialization, even if they are otherwise accepted.ValidatingObjectInputStream.Builder
reject(java.util.regex.Pattern pattern)
Rejects class names that match the supplied pattern for deserialization, even if they are otherwise accepted.ValidatingObjectInputStream.Builder
reject(ClassNameMatcher matcher)
Rejects class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.ValidatingObjectInputStream.Builder
setPredicate(ObjectStreamClassPredicate predicate)
Sets the predicate, null resets to an empty new ObjectStreamClassPredicate.-
Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptions
-
Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter
-
Methods inherited from class org.apache.commons.io.build.AbstractSupplier
asThis
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, getUnchecked
-
-
-
-
Constructor Detail
-
Builder
@Deprecated public Builder()
Deprecated.Constructs a new instance.
-
-
Method Detail
-
accept
public ValidatingObjectInputStream.Builder accept(java.lang.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
public ValidatingObjectInputStream.Builder accept(ClassNameMatcher matcher)
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
public ValidatingObjectInputStream.Builder accept(java.util.regex.Pattern pattern)
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(java.lang.String... patterns)
Accepts the wildcard specified classes for deserialization, unless they are otherwise rejected.- Parameters:
patterns
- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch
- Returns:
- this instance.
- Since:
- 2.18.0
-
get
public ValidatingObjectInputStream get() throws java.io.IOException
Description copied from interface:IOSupplier
Gets a result.- Returns:
- a result.
- Throws:
java.io.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(java.lang.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
public ValidatingObjectInputStream.Builder reject(ClassNameMatcher matcher)
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
public ValidatingObjectInputStream.Builder reject(java.util.regex.Pattern pattern)
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(java.lang.String... patterns)
Rejects the wildcard specified classes for deserialization, even if they are otherwise accepted.- Parameters:
patterns
- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch
- Returns:
- this instance.
- Since:
- 2.18.0
-
setPredicate
public ValidatingObjectInputStream.Builder setPredicate(ObjectStreamClassPredicate predicate)
Sets the predicate, null resets to an empty new ObjectStreamClassPredicate.- Parameters:
predicate
- the predicate.- Returns:
- this instance.
- Since:
- 2.18.0
-
-