Class VarlenaWrapper.Output
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,VarlenaWrapper
- Enclosing interface:
VarlenaWrapper
ResourceOwner to bound the lifetime of
the native reference; the chosen resource owner must be one that will be
released no later than the memory context containing the varlena.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.postgresql.pljava.internal.VarlenaWrapper
VarlenaWrapper.Input, VarlenaWrapper.Output, VarlenaWrapper.Verifier -
Method Summary
Modifier and TypeMethodDescriptionlongadopt(DualState.Key cookie) Return the varlena address to native code and dissociate the varlena from Java.voidclose()voidfree()Actually free aVarlenaWrapper.Output.voidSet theVerifierto be used on content written to this varlena.toString()Return a string describing this object in a way useful for debugging, prefixed with the name (abbreviated for comfort) of the class of the object passed in (the normal JavatoString()method should passthis).voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Method Details
-
setVerifier
Set theVerifierto be used on content written to this varlena.A verifier must be set, either to
NoOpor a datatype-specific subclass ofBase, before writing can succeed.On construction, no verifier is set, so the datatype-specific code can determine whether the
NoOpor a specific verifier will be needed. This method can only be called once, so that this class could then be exposed to client code as anOutputStreamwithout allowing the verifier to be changed.- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
free
Actually free aVarlenaWrapper.Output.close()does not do so, because the typical use of this class is to write to an instance, close it, then let some native code adopt it. If it turns out one won't be adopted and must be freed, use this method.- Throws:
IOException
-
adopt
Description copied from interface:VarlenaWrapperReturn the varlena address to native code and dissociate the varlena from Java.- Specified by:
adoptin interfaceVarlenaWrapper- Parameters:
cookie- Capability held by native code.- Throws:
SQLException
-
toString
-
toString
Description copied from interface:VarlenaWrapperReturn a string describing this object in a way useful for debugging, prefixed with the name (abbreviated for comfort) of the class of the object passed in (the normal JavatoString()method should passthis).Subclasses or consumers are encouraged to call this method and append further details specific to the subclass or consumer. The convention should be that the recursion will stop at some class that will actually construct the abbreviated class name of
oand use it to prefix the returned value.- Specified by:
toStringin interfaceVarlenaWrapper- Parameters:
o- An object whose class name (possibly abbreviated) should be used to prefix the returned string.- Returns:
- Description of this object.
-