/** * Returns a truncated copy of <i>sourceArray</i>. <i>len</i> * entries are copied. * @param sourceArray the source array * @param len the truncate length * @return the truncated array * @throws IllegalArgumentException if the specified object * is not an array (either of reference or primitive * component type) */ public static Object truncateArray(Object sourceArray, int len) { return truncateArray(sourceArray, 0, len); }
/** * Returns a truncated copy of <i>sourceArray</i>. <i>len</i> * entries are copied. * @param sourceArray the source array * @param len the truncate length * @return the truncated array * @throws IllegalArgumentException if the specified object * is not an array (either of reference or primitive * component type) */ public static Object truncateArray(Object sourceArray, int len) { return truncateArray(sourceArray, 0, len); }
public Object getArray(long index, int count) throws SQLException { return ArrayUtil.truncateArray(getArray(), (int)(index - 1), count); }
public Object getArray(long index, int count) throws SQLException { return ArrayUtil.truncateArray(getArray(), (int)(index - 1), count); }
public Object getArray(long index, int count) throws SQLException { return ArrayUtil.truncateArray(getArray(), (int)(index - 1), count); }
public void setBytes(String name, byte[] byteData, int offset, int length) throws JMSException { if(null == byteData) { setObject(name, null); return; } setBytes(name, (byte[])ArrayUtil.truncateArray(byteData, offset, length)); }
protected SQLException prepareFailedResult(int[] actualResults, int index, String message, SQLException caughtException) { actualResults[index] = -3; if(caughtException instanceof BatchUpdateException) { return caughtException; } else { int[] partialResults = (int[])ArrayUtil.truncateArray(actualResults, index); if(null == caughtException) { return new BatchUpdateException(message, partialResults); } else { return new BatchUpdateException(caughtException.getMessage(), caughtException.getSQLState(), caughtException.getErrorCode(), partialResults); } } }
public void setBytes(String name, byte[] byteData, int offset, int length) throws JMSException { if(null == byteData) { setObject(name, null); return; } setBytes(name, (byte[])ArrayUtil.truncateArray(byteData, offset, length)); }
protected SQLException prepareFailedResult(int[] actualResults, int index, String message, SQLException caughtException) { actualResults[index] = -3; if(caughtException instanceof BatchUpdateException) { return caughtException; } else { int[] partialResults = (int[])ArrayUtil.truncateArray(actualResults, index); if(null == caughtException) { return new BatchUpdateException(message, partialResults); } else { return new BatchUpdateException(caughtException.getMessage(), caughtException.getSQLState(), caughtException.getErrorCode(), partialResults); } } }
protected SQLException prepareFailedResult(int[] actualResults, int index, String message, SQLException caughtException) { actualResults[index] = -3; if(caughtException instanceof BatchUpdateException) { return caughtException; } else { int[] partialResults = (int[])ArrayUtil.truncateArray(actualResults, index); if(null == caughtException) { return new BatchUpdateException(message, partialResults); } else { return new BatchUpdateException(caughtException.getMessage(), caughtException.getSQLState(), caughtException.getErrorCode(), partialResults); } } }
public ResultSet getResultSet(long index, int count) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } Integer[] firstColumn = new Integer[count]; for(int ii = 0; ii < count; ii++) { firstColumn[ii] = new Integer(ii + 1); } Object[] secondColumn = ArrayUtil.convertToObjectArray(array); secondColumn = (Object[])ArrayUtil.truncateArray(secondColumn, (int)(index - 1), count); MockResultSet resultSet = new MockResultSet(String.valueOf(hashCode())); resultSet.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); resultSet.setResultSetConcurrency(ResultSet.CONCUR_READ_ONLY); resultSet.addColumn(firstColumn); resultSet.addColumn(secondColumn); return resultSet; }
public ResultSet getResultSet(long index, int count) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } Integer[] firstColumn = new Integer[count]; for(int ii = 0; ii < count; ii++) { firstColumn[ii] = new Integer(ii + 1); } Object[] secondColumn = ArrayUtil.convertToObjectArray(array); secondColumn = (Object[])ArrayUtil.truncateArray(secondColumn, (int)(index - 1), count); MockResultSet resultSet = new MockResultSet(String.valueOf(hashCode())); resultSet.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); resultSet.setResultSetConcurrency(ResultSet.CONCUR_READ_ONLY); resultSet.addColumn(firstColumn); resultSet.addColumn(secondColumn); return resultSet; }
public void writeBytes(byte[] data, int offset, int length) throws JMSException { if(!isInWriteMode()) { throw new MessageNotWriteableException("Message is in read mode"); } if(null == data) { writeObject(null); return; } writeObject(ArrayUtil.truncateArray(data, offset, length)); }
public void writeBytes(byte[] data, int offset, int length) throws JMSException { if(!isInWriteMode()) { throw new MessageNotWriteableException("Message is in read mode"); } if(null == data) { writeObject(null); return; } writeObject(ArrayUtil.truncateArray(data, offset, length)); }
public ResultSet getResultSet(long index, int count) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } Integer[] firstColumn = new Integer[count]; for(int ii = 0; ii < count; ii++) { firstColumn[ii] = ii + 1; } Object[] secondColumn = ArrayUtil.convertToObjectArray(array); secondColumn = (Object[])ArrayUtil.truncateArray(secondColumn, (int)(index - 1), count); MockResultSet resultSet = new MockResultSet(String.valueOf(hashCode())); resultSet.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); resultSet.setResultSetConcurrency(ResultSet.CONCUR_READ_ONLY); resultSet.addColumn(firstColumn); resultSet.addColumn(secondColumn); return resultSet; }