public class AvaticaUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Map<Class,Class> |
BOX |
private static MethodHandle |
GET_LARGE_MAX_ROWS |
private static MethodHandle |
GET_LARGE_UPDATE_COUNT |
private static MethodHandle |
SET_LARGE_MAX_ROWS |
| Modifier | Constructor and Description |
|---|---|
private |
AvaticaUtils() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static ByteArrayOutputStream |
_readFully(InputStream inputStream)
Reads the contents of an input stream and returns a ByteArrayOutputStrema.
|
static Class |
box(Class clazz)
Returns the boxed class.
|
static String |
camelToUpper(String name)
Converts a camelCase name into an upper-case underscore-separated name.
|
static void |
discard(Object o)
Does nothing with its argument.
|
static long |
getLargeMaxRows(Statement statement)
Invokes
Statement#getLargeMaxRows, falling back on
Statement.getMaxRows() if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException. |
static long |
getLargeUpdateCount(Statement statement)
Invokes
Statement#getLargeUpdateCount, falling back on
Statement.getUpdateCount() if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException. |
static <T> T |
instantiatePlugin(Class<T> pluginClass,
String className)
Creates an instance of a plugin class.
|
private static MethodHandle |
method(Class returnType,
Class targetType,
String name,
Class... argTypes) |
static List<?> |
primitiveList(Object array)
Adapts a primitive array into a
List. |
static String |
readFully(InputStream inputStream)
Reads the contents of an input stream and returns as a string.
|
static byte[] |
readFullyToBytes(InputStream inputStream) |
static void |
setLargeMaxRows(Statement statement,
long n)
Invokes
Statement#setLargeMaxRows, falling back on
Statement.setMaxRows(int) if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException. |
static String |
toCamelCase(String name)
Converts an underscore-separated name into a camelCase name.
|
private static final MethodHandle SET_LARGE_MAX_ROWS
private static final MethodHandle GET_LARGE_MAX_ROWS
private static final MethodHandle GET_LARGE_UPDATE_COUNT
private static MethodHandle method(Class returnType, Class targetType, String name, Class... argTypes)
public static void discard(Object o)
public static List<?> primitiveList(Object array)
List. For example,
asList(new double[2]) returns a List<Double>.public static String camelToUpper(String name)
camelToUpper("myJdbcDriver") returns
"MY_JDBC_DRIVER".public static String toCamelCase(String name)
uncamel("MY_JDBC_DRIVER") returns "myJdbcDriver".public static Class box(Class clazz)
box(int.class)
returns java.lang.Integer.public static <T> T instantiatePlugin(Class<T> pluginClass, String className)
If className contains a "#" instead looks for a static field.
T - ClasspluginClass - Class (or interface) to instantiateclassName - Name of implementing classpublic static String readFully(InputStream inputStream) throws IOException
IOExceptionpublic static byte[] readFullyToBytes(InputStream inputStream) throws IOException
IOExceptionstatic ByteArrayOutputStream _readFully(InputStream inputStream) throws IOException
IOExceptionpublic static void setLargeMaxRows(Statement statement, long n) throws SQLException
Statement#setLargeMaxRows, falling back on
Statement.setMaxRows(int) if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException.SQLExceptionpublic static long getLargeMaxRows(Statement statement) throws SQLException
Statement#getLargeMaxRows, falling back on
Statement.getMaxRows() if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException.SQLExceptionpublic static long getLargeUpdateCount(Statement statement) throws SQLException
Statement#getLargeUpdateCount, falling back on
Statement.getUpdateCount() if the method does not exist (before
JDK 1.8) or throws UnsupportedOperationException.SQLExceptionCopyright © 2012–2016 The Apache Software Foundation. All rights reserved.