code: public static Object extractReadOrWrite(final Part part, final DeviceAttribute da, final Object readWrite)
  	    throws DevFailed {
  	// separate read and written values
  
  	final Object result;
  	final int dimRead;
  	if (da.getDimY() != 0) {
  	    dimRead = da.getDimX() * da.getDimY();
  	} else {
  	    dimRead = da.getDimX();
  	}
  	if (Array.getLength(readWrite) < dimRead) {
  	    result = readWrite;
  	} else if (Part.READ.equals(part)) {
  	    result = Array.newInstance(readWrite.getClass().getComponentType(), dimRead);
  	    System.arraycopy(readWrite, 0, result, 0, dimRead);
  	} else {
  	    result = Array.newInstance(readWrite.getClass().getComponentType(), Array.getLength(readWrite) - dimRead);
  	    System.arraycopy(readWrite, dimRead, result, 0, Array.getLength(result));
  	}
  
  	return result;
      }
docs: Extract read or write part of a Tango attribute. For spectrum and image
  
  @param part
  @param da
  @param readWrite
  @return
  @throws DevFailed