/** * Retrieves the SQL type of the elements in this <code>SerialArray</code> * object. The <code>int</code> returned is one of the constants in the class * <code>java.sql.Types</code>. * * @return one of the constants in <code>java.sql.Types</code>, indicating * the SQL type of the elements in this <code>SerialArray</code> object * @throws SerialException if an error occurs; * if {@code free} had previously been called on this object */ public int getBaseType() throws SerialException { isValid(); return baseType; }
/** * Retrieves the DBMS-specific type name for the elements in this * <code>SerialArray</code> object. * * @return the SQL type name used by the DBMS for the base type of this * <code>SerialArray</code> object * @throws SerialException if an error occurs; * if {@code free} had previously been called on this object */ public String getBaseTypeName() throws SerialException { isValid(); return baseTypeName; }
/** * Returns a new array that is a copy of this <code>SerialArray</code> * object. * * @return a copy of this <code>SerialArray</code> object as an * <code>Object</code> in the Java programming language * @throws SerialException if an error occurs; * if {@code free} had previously been called on this object */ public Object getArray() throws SerialException { isValid(); Object dst = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; }
/** * Returns a new array that is a copy of a slice * of this <code>SerialArray</code> object, starting with the * element at the given index and containing the given number * of consecutive elements. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; * the index of the first element is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @return a copy of the designated elements in this <code>SerialArray</code> * object as an <code>Object</code> in the Java programming language * @throws SerialException if an error occurs; * if {@code free} had previously been called on this object */ public Object getArray(long index, int count) throws SerialException { isValid(); Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count); return dst; }
/** * Returns a new array that is a copy of this <code>SerialArray</code> * object, using the given type map for the custom * mapping of each element when the elements are SQL UDTs. * <P> * This method does custom mapping if the array elements are a UDT * and the given type map has an entry for that UDT. * Custom mapping is recursive, * meaning that if, for instance, an element of an SQL structured type * is an SQL structured type that itself has an element that is an SQL * structured type, each structured type that has a custom mapping will be * mapped according to the given type map. * * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped * @return a copy of this <code>SerialArray</code> object as an * <code>Object</code> in the Java programming language * @throws SerialException if an error occurs; * if {@code free} had previously been called on this object */ public Object getArray(Map<String, Class<?>> map) throws SerialException { isValid(); Object dst[] = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; }
throws SerialException isValid(); Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count);