public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static StringBuffer |
appendEscapedIdentifier(StringBuffer sbuf,
String value)
Deprecated.
use
escapeIdentifier(StringBuilder, String) instead |
static StringBuffer |
appendEscapedLiteral(StringBuffer sbuf,
String value,
boolean standardConformingStrings)
Deprecated.
use
escapeLiteral(StringBuilder, String, boolean) instead |
static byte[] |
encodeUTF8(String str)
Encode a string as UTF-8.
|
static StringBuilder |
escapeIdentifier(StringBuilder sbuf,
String value)
Escape the given identifier value and append it to the string builder sbuf.
|
static StringBuilder |
escapeLiteral(StringBuilder sbuf,
String value,
boolean standardConformingStrings)
Escape the given literal value and append it to the string builder sbuf.
|
static int |
parseServerVersionStr(String serverVersion)
Deprecated.
use specific
Version instance |
static String |
toHexString(byte[] data)
Turn a bytearray into a printable form, representing each byte in hex.
|
public static String toHexString(byte[] data)
data
- the bytearray to stringizedata
public static byte[] encodeUTF8(String str)
str
- the string to encodestr
public static StringBuffer appendEscapedLiteral(StringBuffer sbuf, String value, boolean standardConformingStrings) throws SQLException
escapeLiteral(StringBuilder, String, boolean)
insteadsbuf
- the string buffer to append to; or nullvalue
- the string valuestandardConformingStrings
- if standard conforming strings should be usedSQLException
- if the string contains a \0 characterpublic static StringBuilder escapeLiteral(StringBuilder sbuf, String value, boolean standardConformingStrings) throws SQLException
sbuf
- the string builder to append to; or nullvalue
- the string valuestandardConformingStrings
- if standard conforming strings should be usedSQLException
- if the string contains a \0 characterpublic static StringBuffer appendEscapedIdentifier(StringBuffer sbuf, String value) throws SQLException
escapeIdentifier(StringBuilder, String)
insteadsbuf
- the string buffer to append to; or nullvalue
- the string valueSQLException
- if the string contains a \0 characterpublic static StringBuilder escapeIdentifier(StringBuilder sbuf, String value) throws SQLException
escapeLiteral(StringBuilder, String, boolean)
does not.sbuf
- the string builder to append to; or nullvalue
- the string valueSQLException
- if the string contains a \0 character@Deprecated public static int parseServerVersionStr(String serverVersion) throws NumberFormatException
Version
instanceserverVersion
- server vertion in a XXYYZZ formNumberFormatException
Copyright © 2016 PostgreSQL Global Development Group. All rights reserved.