public void setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data) { int size = w*h; int numDataElements = getNumDataElements(); int dataSize = numDataElements*size;  Object pixelData; switch (getTransferType()) { case DataBuffer.TYPE_BYTE: pixelData = new byte[numDataElements]; break; case DataBuffer.TYPE_USHORT: pixelData = new short[numDataElements]; break; case DataBuffer.TYPE_INT: pixelData = new int[numDataElements]; break; default:  throw new ClassCastException(); } int inOffset = 0;  for (int yy=y; yy<(y+h); yy++) { for (int xx=x; xx<(x+w); xx++) { System.arraycopy(obj, inOffset, pixelData, 0, numDataElements); setDataElements(xx, yy, pixelData, data); inOffset += numDataElements; } } }
public abstract void setDataElements(int x, int y, Object obj, DataBuffer data);
  public void setDataElements(int x, int y, int w, int h,			      Object obj, DataBuffer data)  {    int size = w*h;		int numDataElements = getNumDataElements();    int dataSize = numDataElements*size;		Object pixelData;    switch (getTransferType())      {      case DataBuffer.TYPE_BYTE:				pixelData = new byte[numDataElements];				break;      case DataBuffer.TYPE_USHORT:				pixelData = new short[numDataElements];				break;      case DataBuffer.TYPE_INT:				pixelData = new int[numDataElements];				break;      default:				// Seems like the only sensible thing to do.				throw new ClassCastException();		}		int inOffset = 0;    for (int yy=y; yy<(y+h); yy++)      {	for (int xx=x; xx<(x+w); xx++)	  {	    System.arraycopy(obj, inOffset, pixelData, 0,			     numDataElements);				setDataElements(xx, yy, pixelData, data);				inOffset += numDataElements;			}		}	}