/** * Check to see if this object had previously had its {@code free} method * called * * @throws SerialException */ private void isValid() throws SerialException { if (buf == null) { throw new SerialException("Error: You cannot call a method on a " + "SerialBlob instance once free() has been called."); } }
/** * Retrieves a <code>ResultSet</code> object that contains all of * the elements in the <code>ARRAY</code> value that this * <code>SerialArray</code> object represents. * If appropriate, the elements of the array are mapped using the connection's * type map; otherwise, the standard mapping is used. * * @return a <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException if called with the cause set to * {@code UnsupportedOperationException} */ public ResultSet getResultSet() throws SerialException { SerialException se = new SerialException(); se.initCause(new UnsupportedOperationException()); throw se; }
/** * Check to see if this object had previously had its {@code free} method * called * * @throws SerialException */ private void isValid() throws SerialException { if (elements == null) { throw new SerialException("Error: You cannot call a method on a " + "SerialArray instance once free() has been called."); } }
/** * Retrieves a <code>ResultSet</code> object holding the elements of * the subarray that starts at * index <i>index</i> and contains up to <i>count</i> successive elements. * This method uses the connection's type map to map the elements of * the array if the map contains * an entry for the base type. Otherwise, the standard mapping is used. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; the index of the * first element in the array is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @return a <code>ResultSet</code> object containing the designated * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException if called with the cause set to * {@code UnsupportedOperationException} */ public ResultSet getResultSet(long index, int count) throws SerialException { SerialException se = new SerialException(); se.initCause(new UnsupportedOperationException()); throw se; }
/** * Check to see if this object had previously had its {@code free} method * called * * @throws SerialException */ private void isValid() throws SerialException { if (buf == null) { throw new SerialException("Error: You cannot call a method on a " + "SerialClob instance once free() has been called."); } }
/** * * Retrieves a <code>ResultSet</code> object that contains all of * the elements of the SQL <code>ARRAY</code> * value represented by this <code>SerialArray</code> object. This method uses * the specified map for type map customizations unless the base type of the * array does not match a user-defined type (UDT) in <i>map</i>, in * which case it uses the * standard mapping. This version of the method <code>getResultSet</code> * uses either the given type map or the standard mapping; it never uses the * type map associated with the connection. * * @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 <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException if called with the cause set to * {@code UnsupportedOperationException} */ public ResultSet getResultSet(Map<String, Class<?>> map) throws SerialException { SerialException se = new SerialException(); se.initCause(new UnsupportedOperationException()); throw se; }
/** * Constructs a new <code>SerialDatalink</code> object from the given * <code>java.net.URL</code> object. * <P> * @param url the {@code URL} to create the {@code SerialDataLink} from * @throws SerialException if url parameter is a null */ public SerialDatalink(URL url) throws SerialException { if (url == null) { throw new SerialException("Cannot serialize empty URL instance"); } this.url = url; }
throws SerialException SerialException se = new SerialException(); se.initCause(new UnsupportedOperationException()); throw se;
/** * Returns a new URL that is a copy of this <code>SerialDatalink</code> * object. * * @return a copy of this <code>SerialDatalink</code> object as a * <code>URL</code> object in the Java programming language. * @throws SerialException if the <code>URL</code> object cannot be de-serialized */ public URL getDatalink() throws SerialException { URL aURL = null; try { aURL = new URL((this.url).toString()); } catch (java.net.MalformedURLException e) { throw new SerialException("MalformedURLException: " + e.getMessage()); } return aURL; }
/** * Returns an <code>Object</code> representing the SQL structured type * to which this <code>SerialRef</code> object refers. * * @return an object instance resolved from the Ref reference * @throws SerialException if an error is encountered in the reference * resolution */ public Object getObject() throws SerialException { if (reference != null) { try { return reference.getObject(); } catch (SQLException e) { throw new SerialException("SQLException: " + e.getMessage()); } } if (object != null) { return object; } throw new SerialException("The object is not set"); }
/** * Returns an <code>Object</code> representing the SQL structured type * to which this <code>SerialRef</code> object refers. The attributes * of the structured type are mapped according to the given type map. * * @param map a <code>java.util.Map</code> object containing zero or * more entries, with each entry consisting of 1) a <code>String</code> * 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 an object instance resolved from the Ref reference and mapped * according to the supplied type map * @throws SerialException if an error is encountered in the reference * resolution */ public Object getObject(java.util.Map<String,Class<?>> map) throws SerialException { map = new Hashtable<String, Class<?>>(map); if (object != null) { return map.get(object); } else { throw new SerialException("The object is not set"); } }
@Override public Reader getCharacterStream() throws SerialException { throw new SerialException(); } };
/** * Returns a {@code Reader} object that contains a partial * {@code SerialClob} value, starting * with the character specified by pos, which is length characters in length. * * @param pos the offset to the first character of the partial value to * be retrieved. The first character in the {@code SerialClob} is at position 1. * @param length the length in characters of the partial value to be retrieved. * @return {@code Reader} through which the partial {@code SerialClob} * value can be read. * @throws SQLException if pos is less than 1 or if pos is greater than the * number of characters in the {@code SerialClob} or if pos + length * is greater than the number of characters in the {@code SerialClob}; * @throws SerialException if the {@code free} method had been previously * called on this object * @since 1.6 */ public Reader getCharacterStream(long pos, long length) throws SQLException { isValid(); if (pos < 1 || pos > len) { throw new SerialException("Invalid position in Clob object set"); } if ((pos-1) + length > len) { throw new SerialException("Invalid position and substring length"); } if (length <= 0) { throw new SerialException("Invalid length specified"); } return new CharArrayReader(buf, (int)pos, (int)length); }
/** * Sets the SQL structured type that this <code>SerialRef</code> object * references to the given <code>Object</code> object. * * @param obj an <code>Object</code> representing the SQL structured type * to be referenced * @throws SerialException if an error is encountered generating the * the structured type referenced by this <code>SerialRef</code> object */ public void setObject(Object obj) throws SerialException { try { reference.setObject(obj); } catch (SQLException e) { throw new SerialException("SQLException: " + e.getMessage()); } object = obj; }
throw new SerialException("Invalid offset in byte array set"); throw new SerialException("Invalid position in BLOB object set"); throw new SerialException("Buffer is not sufficient to hold the value"); throw new SerialException("Invalid OffSet. Cannot have combined offset " + "and length that is greater that the Blob buffer");
isValid(); if (pos < 1 || pos > this.length()) { throw new SerialException("Invalid position in BLOB object set"); throw new SerialException("length is < 1 or pos + length >" + "total number of bytes");
throw new SerialException("Invalid offset in byte array set"); throw new SerialException("Invalid position in Clob object set"); throw new SerialException("Buffer is not sufficient to hold the value"); throw new SerialException("Invalid OffSet. Cannot have combined offset " + " and length that is greater that the Blob buffer");
throw new SerialException("Invalid arguments: position cannot be " + "less than 1 or greater than the length of the SerialBlob");
throw new SerialException("SerialClob: " + ex.getMessage());
/** * Truncates the <code>CLOB</code> value that this <code>SerialClob</code> * object represents so that it has a length of <code>len</code> * characters. * <p> * Truncating a <code>SerialClob</code> object to length 0 has the effect of * clearing its contents. * * @param length the length, in bytes, to which the <code>CLOB</code> * value should be truncated * @throws SerialException if there is an error accessing the * <code>CLOB</code> value; * if the {@code free} method had been previously called on this object */ public void truncate(long length) throws SerialException { isValid(); if (length > len) { throw new SerialException ("Length more than what can be truncated"); } else { len = length; // re-size the buffer if (len == 0) { buf = new char[] {}; } else { buf = (this.getSubString(1, (int)len)).toCharArray(); } } }