Package org.postgresql.pljava.internal
Class VarlenaWrapper.Verifier.Base
java.lang.Object
org.postgresql.pljava.internal.VarlenaWrapper.Verifier
org.postgresql.pljava.internal.VarlenaWrapper.Verifier.Base
- Enclosing class:
VarlenaWrapper.Verifier
Verifier to be extended to verify byte streams for specific types.
A subclass should override VarlenaWrapper.Verifier.verify(java.io.InputStream) with a method that reads
the InputStream and throws an exception unless the entire stream was
successfully read and represented a well-formed instance of the type.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.postgresql.pljava.internal.VarlenaWrapper.Verifier
VarlenaWrapper.Verifier.Base, VarlenaWrapper.Verifier.NoOp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcancel()Cancel this verifier.final voidfinish()Wait for the verify task and rethrow any exception it might have thrown.final VarlenaWrapper.Verifierschedule()Set up theverifymethod to be executed in another thread.final voidupdate(InputStream is) Send the nextInputStreamof content to be verified.final voidupdate(org.postgresql.pljava.internal.VarlenaWrapper.Output.State state, ByteBuffer bb) Convenience method that callsflip()on a byte buffer, wraps it in aBufferWrapper, and passes it toVarlenaWrapper.Verifier.update(java.io.InputStream).Methods inherited from class org.postgresql.pljava.internal.VarlenaWrapper.Verifier
call, verify
-
Constructor Details
-
Base
protected Base()
-
-
Method Details
-
schedule
Description copied from class:VarlenaWrapper.VerifierSet up theverifymethod to be executed in another thread.- Overrides:
schedulein classVarlenaWrapper.Verifier- Returns:
- This
Verifierobject.
-
update
Description copied from class:VarlenaWrapper.VerifierSend the nextInputStreamof content to be verified.It is assumed, but not checked here, that any
InputStreamsupplied to this method supportsmarkandresetefficiently.If the verifier has already thrown an exception, it will be rethrown here in the current thread.
- Overrides:
updatein classVarlenaWrapper.Verifier- Parameters:
is- InputStream representing the next range of bytes to be verified.- Throws:
SQLException- if a verification error has already been detected, the verifier has been cancelled, etc.
-
update
public final void update(org.postgresql.pljava.internal.VarlenaWrapper.Output.State state, ByteBuffer bb) throws SQLException Description copied from class:VarlenaWrapper.VerifierConvenience method that callsflip()on a byte buffer, wraps it in aBufferWrapper, and passes it toVarlenaWrapper.Verifier.update(java.io.InputStream).Note that the
NoOpversion of this method does none of that; in particular, the byte buffer will not have been flipped. This should not be a problem, as the thread passing the buffer to this method had better make no further use of it anyway.- Overrides:
updatein classVarlenaWrapper.Verifier- Parameters:
state- The state object protecting the native memory.bb- Byte buffer containing next range of content to verify.- Throws:
SQLException- if a verification error has already been detected, the verifier has been cancelled, etc.
-
finish
Description copied from class:VarlenaWrapper.VerifierWait for the verify task and rethrow any exception it might have thrown.- Overrides:
finishin classVarlenaWrapper.Verifier- Throws:
SQLException- any exception thrown by the verify method, or for unexpected conditions such as interruption while waiting.
-
cancel
Description copied from class:VarlenaWrapper.VerifierCancel this verifier.- Overrides:
cancelin classVarlenaWrapper.Verifier- Throws:
SQLException
-