/* */ package quicktime.util;
/* */
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */
/* */ public class QTPointerRef extends QTObject
/* */ {
/* */ private transient int size;
/* */
/* */ protected QTPointerRef(int paramInt, boolean paramBoolean)
/* */ throws QTException
/* */ {
/* 42 */ this(allocate(paramInt, paramBoolean), paramInt, null);
/* 43 */ UtilException.checkError(MemError());
/* */ }
/* */
/* */ protected QTPointerRef(int paramInt1, int paramInt2, Object paramObject)
/* */ {
/* 53 */ super(paramInt1, paramObject);
/* */
/* 56 */ if (paramInt2 < 0)
/* */ {
/* */ try {
/* 59 */ disposeQTObject();
/* */ } catch (QTException localQTException) {
/* */ }
/* 62 */ throw new ArrayIndexOutOfBoundsException();
/* */ }
/* */
/* 65 */ this.size = paramInt2;
/* */ }
/* */
/* */ private static int allocate(int paramInt, boolean paramBoolean)
/* */ throws UtilException
/* */ {
/* 75 */ if (QTSession.hasSecurityRestrictions()) {
/* 76 */ paramBoolean = true;
/* */ }
/* */
/* 79 */ int i = paramBoolean ? NewPtrClear(paramInt) : NewPtr(paramInt);
/* 80 */ if (i == 0) throw new UtilException(-108);
/* 81 */ return i;
/* */ }
/* */
/* */ public int getSize()
/* */ {
/* 92 */ return this.size;
/* */ }
/* */
/* */ public byte[] getBytes()
/* */ {
/* 99 */ byte[] arrayOfByte = new byte[this.size];
/* 100 */ getBytesAt(0, this.size, arrayOfByte, 0);
/* 101 */ return arrayOfByte;
/* */ }
/* */
/* */ protected void getBytesAt(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3)
/* */ {
/* 112 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfByte, paramInt3, paramInt2);
/* */ }
/* */
/* */ protected void setBytesAt(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3)
/* */ {
/* 125 */ copyArrayToPointer(paramArrayOfByte, paramInt3, _ID(), paramInt1, paramInt2);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, byte[] paramArrayOfByte, int paramInt2, int paramInt3)
/* */ {
/* 137 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 1, paramInt2, paramArrayOfByte.length);
/* 138 */ getBytesAt(paramInt1, paramInt3, paramArrayOfByte, paramInt2);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, short[] paramArrayOfShort, int paramInt2, int paramInt3)
/* */ {
/* 150 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 2, paramInt2, paramArrayOfShort.length);
/* 151 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfShort, paramInt2 * 2, paramInt3 * 2);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, char[] paramArrayOfChar, int paramInt2, int paramInt3)
/* */ {
/* 163 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 2, paramInt2, paramArrayOfChar.length);
/* 164 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfChar, paramInt2 * 2, paramInt3 * 2);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, int[] paramArrayOfInt, int paramInt2, int paramInt3)
/* */ {
/* 176 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 4, paramInt2, paramArrayOfInt.length);
/* 177 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfInt, paramInt2 * 4, paramInt3 * 4);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, float[] paramArrayOfFloat, int paramInt2, int paramInt3)
/* */ {
/* 189 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 4, paramInt2, paramArrayOfFloat.length);
/* 190 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfFloat, paramInt2 * 4, paramInt3 * 4);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, long[] paramArrayOfLong, int paramInt2, int paramInt3)
/* */ {
/* 202 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 8, paramInt2, paramArrayOfLong.length);
/* 203 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfLong, paramInt2 * 8, paramInt3 * 8);
/* */ }
/* */
/* */ public final void copyToArray(int paramInt1, double[] paramArrayOfDouble, int paramInt2, int paramInt3)
/* */ {
/* 215 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 8, paramInt2, paramArrayOfDouble.length);
/* 216 */ copyPointerToArray(_ID(), paramInt1, paramArrayOfDouble, paramInt2 * 8, paramInt3 * 8);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, byte[] paramArrayOfByte, int paramInt2, int paramInt3)
/* */ {
/* 228 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 1, paramInt2, paramArrayOfByte.length);
/* 229 */ setBytesAt(paramInt1, paramInt3, paramArrayOfByte, paramInt2);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, short[] paramArrayOfShort, int paramInt2, int paramInt3)
/* */ {
/* 241 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 2, paramInt2, paramArrayOfShort.length);
/* 242 */ copyArrayToPointer(paramArrayOfShort, paramInt2 * 2, _ID(), paramInt1, paramInt3 * 2);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, char[] paramArrayOfChar, int paramInt2, int paramInt3)
/* */ {
/* 254 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 2, paramInt2, paramArrayOfChar.length);
/* 255 */ copyArrayToPointer(paramArrayOfChar, paramInt2 * 2, _ID(), paramInt1, paramInt3 * 2);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, int[] paramArrayOfInt, int paramInt2, int paramInt3)
/* */ {
/* 267 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 4, paramInt2, paramArrayOfInt.length);
/* 268 */ copyArrayToPointer(paramArrayOfInt, paramInt2 * 4, _ID(), paramInt1, paramInt3 * 4);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, float[] paramArrayOfFloat, int paramInt2, int paramInt3)
/* */ {
/* 280 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 4, paramInt2, paramArrayOfFloat.length);
/* 281 */ copyArrayToPointer(paramArrayOfFloat, paramInt2 * 4, _ID(), paramInt1, paramInt3 * 4);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, long[] paramArrayOfLong, int paramInt2, int paramInt3)
/* */ {
/* 293 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 8, paramInt2, paramArrayOfLong.length);
/* 294 */ copyArrayToPointer(paramArrayOfLong, paramInt2 * 8, _ID(), paramInt1, paramInt3 * 8);
/* */ }
/* */
/* */ public final void copyFromArray(int paramInt1, double[] paramArrayOfDouble, int paramInt2, int paramInt3)
/* */ {
/* 306 */ QTUtils.doBoundsChecks(_ID(), paramInt1, this.size, paramInt3, 8, paramInt2, paramArrayOfDouble.length);
/* 307 */ copyArrayToPointer(paramArrayOfDouble, paramInt2 * 8, _ID(), paramInt1, paramInt3 * 8);
/* */ }
/* */
/* */ public String toString()
/* */ {
/* 312 */ return super.toString() + "[size=" + getSize() + "]";
/* */ }
/* */
/* */ protected int makeAndCopyPtr(int paramInt1, int paramInt2)
/* */ {
/* 319 */ QTUtils.checkQTObjectSizeAndOffset(this, paramInt1, this.size, null);
/* */
/* 321 */ int i = 0;
/* */ try {
/* 323 */ i = allocate(paramInt2, false);
/* */ } catch (UtilException localUtilException) {
/* 325 */ throw new QTRuntimeException(localUtilException);
/* */ }
/* */
/* 328 */ BlockMove(_ID() + paramInt1, i, this.size);
/* 329 */ return i;
/* */ }
/* */ protected byte getByteAt(int paramInt) {
/* 332 */ return getByteFromPointer(_ID(), paramInt); }
/* 333 */ protected short getShortAt(int paramInt) { return getShortFromPointer(_ID(), paramInt); }
/* 334 */ protected int getIntAt(int paramInt) { return getIntFromPointer(_ID(), paramInt); }
/* 335 */ protected long getLongAt(int paramInt) { return getLongFromPointer(_ID(), paramInt); }
/* 336 */ protected float getFloatAt(int paramInt) { return getFloatFromPointer(_ID(), paramInt); }
/* 337 */ protected double getDoubleAt(int paramInt) { return getDoubleFromPointer(_ID(), paramInt); }
/* */ protected void setByteAt(int paramInt, byte paramByte) {
/* 339 */ setByteInPointer(_ID(), paramInt, paramByte); }
/* 340 */ protected void setShortAt(int paramInt, short paramShort) { setShortInPointer(_ID(), paramInt, paramShort); }
/* 341 */ protected void setIntAt(int paramInt1, int paramInt2) { setIntInPointer(_ID(), paramInt1, paramInt2); }
/* 342 */ protected void setLongAt(int paramInt, long paramLong) { setLongInPointer(_ID(), paramInt, paramLong); }
/* 343 */ protected void setFloatAt(int paramInt, float paramFloat) { setFloatInPointer(_ID(), paramInt, paramFloat); }
/* 344 */ protected void setDoubleAt(int paramInt, double paramDouble) { setDoubleInPointer(_ID(), paramInt, paramDouble); }
/* */
/* */
/* */ protected int strlen(int paramInt)
/* */ {
/* 352 */ int i = 0;
/* 353 */ while (getByteAt(paramInt++) != 0) i++;
/* 354 */ return i;
/* */ }
/* */
/* */ protected String getCStringAt(int paramInt)
/* */ throws UtilException
/* */ {
/* 363 */ int i = strlen(paramInt);
/* 364 */ if (i > getSize()) throw new UtilException(-50);
/* */
/* 366 */ byte[] arrayOfByte = new byte[i];
/* 367 */ getBytesAt(paramInt, i, arrayOfByte, 0);
/* */
/* 369 */ return new String(arrayOfByte);
/* */ }
/* */
/* */ protected void setCStringAt(int paramInt1, int paramInt2, String paramString)
/* */ throws UtilException
/* */ {
/* 380 */ paramInt2 = Math.min(paramInt2, paramString.length());
/* 381 */ if (paramInt2 + paramInt1 > getSize()) throw new UtilException(-50);
/* */
/* 383 */ byte[] arrayOfByte = paramString.getBytes();
/* 384 */ setBytesAt(paramInt1, paramInt2, arrayOfByte, 0);
/* 385 */ setByteAt(paramInt1 + paramInt2, (byte)0);
/* */ }
/* */
/* */ protected String getPStringAt(int paramInt)
/* */ throws UtilException
/* */ {
/* 394 */ int i = getByteAt(paramInt++);
/* 395 */ if (i > getSize()) throw new UtilException(-50);
/* */
/* 397 */ byte[] arrayOfByte = new byte[i];
/* 398 */ getBytesAt(paramInt, i, arrayOfByte, 0);
/* */
/* 400 */ return new String(arrayOfByte);
/* */ }
/* */
/* */ protected void setPStringAt(int paramInt1, int paramInt2, String paramString)
/* */ throws UtilException
/* */ {
/* 412 */ paramInt2 = Math.min(Math.min(paramInt2, paramString.length()), 255);
/* 413 */ if (paramInt2 + paramInt1 > getSize()) throw new UtilException(-50);
/* */
/* 415 */ setByteAt(paramInt1++, (byte)paramInt2);
/* */
/* 417 */ byte[] arrayOfByte = paramString.getBytes();
/* 418 */ setBytesAt(paramInt1, paramInt2, arrayOfByte, 0);
/* */ }
/* */
/* */ private static native short MemError();
/* */
/* */ private static native int NewPtrClear(int paramInt);
/* */
/* */ private static native int NewPtr(int paramInt);
/* */
/* */ private static native void BlockMove(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, short[] paramArrayOfShort, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, char[] paramArrayOfChar, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, int[] paramArrayOfInt, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, float[] paramArrayOfFloat, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, long[] paramArrayOfLong, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, double[] paramArrayOfDouble, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(byte[] paramArrayOfByte, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(short[] paramArrayOfShort, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(char[] paramArrayOfChar, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(float[] paramArrayOfFloat, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(long[] paramArrayOfLong, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native void copyArrayToPointer(double[] paramArrayOfDouble, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native byte getByteFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native short getShortFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native int getIntFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native long getLongFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native double getDoubleFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native float getFloatFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native void setByteInPointer(int paramInt1, int paramInt2, byte paramByte);
/* */
/* */ private static native void setShortInPointer(int paramInt1, int paramInt2, short paramShort);
/* */
/* */ private static native void setIntInPointer(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void setLongInPointer(int paramInt1, int paramInt2, long paramLong);
/* */
/* */ private static native void setFloatInPointer(int paramInt1, int paramInt2, float paramFloat);
/* */
/* */ private static native void setDoubleInPointer(int paramInt1, int paramInt2, double paramDouble);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.util.QTPointerRef
* JD-Core Version: 0.6.2
*/