Package org.postgresql.util
Class PGbytea
java.lang.Object
org.postgresql.util.PGbytea
Converts to and from the postgresql bytea datatype used by the backend.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendHexString(StringBuilder sb, byte[] buf, int offset, int length) Appends given byte array as hex string.static byte @PolyNull []toBytes(byte @PolyNull [] s) static StringtoPGLiteral(Object value) Deprecated.static StringtoPGLiteral(Object value, SqlSerializationContext context) Formats input object asbytealiteral like'\xcafebabe'::bytea.static @PolyNull StringtoPGString(byte @PolyNull [] buf)
-
Constructor Details
-
PGbytea
public PGbytea()
-
-
Method Details
-
toBytes
- Throws:
SQLException
-
toPGString
-
appendHexString
Appends given byte array as hex string. See HexEncodingBenchmark for the benchmark.- Parameters:
sb- output builderbuf- buffer to appendoffset- offset within the bufferlength- the length of sequence to append
-
toPGLiteral
Deprecated.prefertoPGLiteral(Object, SqlSerializationContext)to clarify the behaviour regardingInputStreamobjectsFormats input object asbytealiteral like'\xcafebabe'::bytea. The following inputs are supported:byte[],StreamWrapper, andByteStreamWriter.- Parameters:
value- input value to format- Returns:
- formatted value
- Throws:
IOException- in case there's underflow in the input value
-
toPGLiteral
Formats input object asbytealiteral like'\xcafebabe'::bytea. The following inputs are supported:byte[],StreamWrapper, andByteStreamWriter.- Parameters:
value- input value to formatcontext- specifies configuration for converting the parameters to string- Returns:
- formatted value
- Throws:
IOException- in case there's underflow in the input value
-
toPGLiteral(Object, SqlSerializationContext)to clarify the behaviour regardingInputStreamobjects