Class VarlenaWrapper.Output
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,Datum
,VarlenaWrapper
,DatumImpl
- 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.adt.spi.Datum
Datum.Accessor<B,
L extends Datum.Layout>, Datum.Layout Nested classes/interfaces inherited from interface org.postgresql.pljava.pg.DatumImpl
DatumImpl.IStream<T extends DatumImpl.Input>
Nested classes/interfaces inherited from interface org.postgresql.pljava.internal.VarlenaWrapper
VarlenaWrapper.Input, VarlenaWrapper.Output, VarlenaWrapper.Verifier
-
Method Summary
Modifier and TypeMethodDescriptionlong
adopt()
Dissociate the datum from Java and return its address to native code.void
close()
void
free()
Actually free aVarlenaWrapper.Output
.void
Set theVerifier
to 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
).void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Method Details
-
setVerifier
Set theVerifier
to be used on content written to this varlena.A verifier must be set, either to
NoOp
or a datatype-specific subclass ofBase
, before writing can succeed.On construction, no verifier is set, so the datatype-specific code can determine whether the
NoOp
or 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 anOutputStream
without allowing the verifier to be changed.- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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:DatumImpl
Dissociate the datum from Java and return its address to native code.- Specified by:
adopt
in interfaceDatumImpl
- Throws:
SQLException
-
toString
-
toString
Description copied from interface:VarlenaWrapper
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
).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
o
and use it to prefix the returned value.- Specified by:
toString
in interfaceDatumImpl
- Specified by:
toString
in interfaceVarlenaWrapper
- Parameters:
o
- An object whose class name (possibly abbreviated) should be used to prefix the returned string.- Returns:
- Description of this object.
-