Package quicktime.io

Source Code of quicktime.io.QTFile$CInfoPBRec

/*     */ package quicktime.io;
/*     */
/*     */ import com.apple.mrj.macos.toolbox.FSSpec;
/*     */ import java.awt.FileDialog;
/*     */ import java.awt.Frame;
/*     */ import java.io.File;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.jdirect.QTNative;
/*     */ import quicktime.std.StdQTException;
/*     */ import quicktime.std.image.GraphicsExporter;
/*     */ import quicktime.std.image.GraphicsImporter;
/*     */ import quicktime.std.image.GraphicsImporterInfo;
/*     */ import quicktime.std.movies.MovieProgress;
/*     */ import quicktime.std.movies.media.DataRef;
/*     */ import quicktime.std.music.SynthesizerConnections;
/*     */ import quicktime.std.qtcomponents.MovieImporter;
/*     */ import quicktime.std.sg.SequenceGrabber;
/*     */ import quicktime.util.EndianOrder;
/*     */ import quicktime.util.QTByteObject;
/*     */ import quicktime.util.QTUtils;
/*     */ import quicktime.util.UtilException;
/*     */
/*     */ public final class QTFile extends File
/*     */ {
/*  33 */   private static boolean apriori = QTSession.apriori();
/*     */
/*  35 */   private static boolean debug = false;
/*     */
/*  39 */   public static final int[] kStandardQTFileTypes = { 1299148630, 1903454566 };
/*     */   public static final int kReadPermission = 256;
/*     */   public static final int kWritePermission = 512;
/*     */   public static final int kDeletePermission = 1024;
/*     */   private transient byte[] fileSpec;
/*     */
/*     */   public static QTFile fromGraphicsImporter(GraphicsImporter paramGraphicsImporter)
/*     */     throws QTException
/*     */   {
/*  57 */     byte[] arrayOfByte = makeFSSpec();
/*  58 */     int i = GraphicsImportGetDataFile(QTObject.ID(paramGraphicsImporter), arrayOfByte);
/*  59 */     StdQTException.checkError(i);
/*  60 */     return new QTFile(arrayOfByte);
/*     */   }
/*     */
/*     */   public static GraphicsImporterInfo fromGraphicsImporter(GraphicsImporter paramGraphicsImporter, QTFile paramQTFile, String paramString)
/*     */     throws QTException
/*     */   {
/*  71 */     int[] arrayOfInt = new int[1];
/*  72 */     byte[] arrayOfByte = makeFSSpec();
/*  73 */     short[] arrayOfShort = new short[1];
/*  74 */     int i = GraphicsImportDoExportImageFileDialog(QTObject.ID(paramGraphicsImporter), paramQTFile != null ? paramQTFile.getFSSpec(true, 512) : null, paramString != null ? QTUtils.String2PString(paramString, 255) : null, 0, arrayOfInt, arrayOfByte, arrayOfShort);
/*     */
/*  81 */     StdQTException.checkError(i);
/*  82 */     return new GraphicsImporterInfo(arrayOfInt[0], new QTFile(arrayOfByte), arrayOfShort[0]);
/*     */   }
/*     */
/*     */   public static QTFile fromGraphicsExporterInput(GraphicsExporter paramGraphicsExporter)
/*     */     throws QTException
/*     */   {
/*  92 */     byte[] arrayOfByte = makeFSSpec();
/*  93 */     int i = GraphicsExportGetInputFile(QTObject.ID(paramGraphicsExporter), arrayOfByte);
/*  94 */     StdQTException.checkError(i);
/*  95 */     return new QTFile(arrayOfByte);
/*     */   }
/*     */
/*     */   public static QTFile fromGraphicsExporterOutput(GraphicsExporter paramGraphicsExporter)
/*     */     throws QTException
/*     */   {
/* 105 */     byte[] arrayOfByte = makeFSSpec();
/* 106 */     int i = GraphicsExportGetOutputFile(QTObject.ID(paramGraphicsExporter), arrayOfByte);
/* 107 */     StdQTException.checkError(i);
/* 108 */     return new QTFile(arrayOfByte);
/*     */   }
/*     */
/*     */   public static QTFile fromSequenceGrabber(SequenceGrabber paramSequenceGrabber)
/*     */     throws QTException
/*     */   {
/* 118 */     byte[] arrayOfByte = makeFSSpec();
/* 119 */     int[] arrayOfInt = { 0 };
/* 120 */     int i = SGGetDataOutput(QTObject.ID(paramSequenceGrabber), arrayOfByte, arrayOfInt);
/* 121 */     StdQTException.checkError(i);
/* 122 */     return new QTFile(arrayOfByte);
/*     */   }
/*     */
/*     */   public static QTFile fromSynthesizerConnections(SynthesizerConnections paramSynthesizerConnections)
/*     */     throws QTException
/*     */   {
/* 132 */     int i = getIntFromArray(paramSynthesizerConnections.getBytes(), 24);
/* 133 */     if (i == 0)
/* 134 */       return null;
/* 135 */     byte[] arrayOfByte = makeFSSpec();
/* 136 */     copyPointerToArray(i, 0, arrayOfByte, 0, arrayOfByte.length);
/* 137 */     return new QTFile(arrayOfByte);
/*     */   }
/*     */
/*     */   public static void checkSecurity(String paramString, int paramInt)
/*     */   {
/* 149 */     SecurityManager localSecurityManager = System.getSecurityManager();
/* 150 */     if (localSecurityManager != null) {
/* 151 */       int i = 0;
/* 152 */       if ((paramInt & 0x100) != 0) {
/* 153 */         localSecurityManager.checkRead(paramString);
/* 154 */         i = 1;
/*     */       }
/* 156 */       if ((paramInt & 0x200) != 0) {
/* 157 */         localSecurityManager.checkWrite(paramString);
/* 158 */         i = 1;
/*     */       }
/* 160 */       if ((paramInt & 0x400) != 0) {
/* 161 */         localSecurityManager.checkDelete(paramString);
/* 162 */         i = 1;
/*     */       }
/* 164 */       if (i == 0)
/* 165 */         throw new SecurityException(paramString + ",Unknown permission request:0x" + Integer.toHexString(paramInt));
/*     */     }
/*     */   }
/*     */
/*     */   public static QTFile resolveAlias(AliasHandle paramAliasHandle)
/*     */     throws QTException
/*     */   {
/* 178 */     byte[] arrayOfByte1 = makeFSSpec();
/* 179 */     byte[] arrayOfByte2 = { 0 };
/* 180 */     int i = ResolveAlias(null, QTObject.ID(paramAliasHandle), arrayOfByte1, arrayOfByte2);
/* 181 */     QTIOException.checkError(i, QTUtils.PString2String(arrayOfByte1, 6));
/* 182 */     QTFile localQTFile = new QTFile(arrayOfByte1);
/* 183 */     if (System.getSecurityManager() != null) {
/*     */       try {
/* 185 */         checkSecurity(localQTFile.getCanonicalPath(), 256);
/*     */       } catch (IOException localIOException) {
/* 187 */         throw new QTIOException(localIOException.getMessage());
/*     */       }
/*     */     }
/*     */
/* 191 */     return localQTFile;
/*     */   }
/*     */
/*     */   private static int getNumTypes(int[] paramArrayOfInt)
/*     */   {
/* 200 */     if (paramArrayOfInt == null) return -1;
/* 201 */     int i = paramArrayOfInt.length;
/* 202 */     if (i == 0) return -1;
/* 203 */     if (i > 4) return 4;
/* 204 */     return i;
/*     */   }
/*     */
/*     */   public static QTFile standardGetFilePreview(int[] paramArrayOfInt)
/*     */     throws QTException
/*     */   {
/*     */     byte[] arrayOfByte1;
/* 215 */     if (QTSession.isCurrentOS(4)) {
/* 216 */       FileDialog localFileDialog = new FileDialog(new Frame(), "Open File...");
/*     */
/* 218 */       localFileDialog.show();
/* 219 */       if (localFileDialog.getFile() == null)
/* 220 */         throw new QTIOException(-128, "");
/* 221 */       arrayOfByte1 = path2Spec(localFileDialog.getDirectory() + localFileDialog.getFile(), true);
/*     */
/* 223 */       return new QTFile(localFileDialog.getDirectory() + localFileDialog.getFile(), arrayOfByte1);
/*     */     }
/*     */
/* 226 */     synchronized (QTNative.globalsLock) {
/* 227 */       byte[] arrayOfByte2 = makeStdFileReply();
/*     */
/* 229 */       StandardGetFilePreview(0, (short)getNumTypes(paramArrayOfInt), paramArrayOfInt, arrayOfByte2);
/* 230 */       if (arrayOfByte2[0] == 0)
/* 231 */         throw new QTIOException(-128, "");
/* 232 */       arrayOfByte1 = makeFSSpec();
/* 233 */       System.arraycopy(arrayOfByte2, 6, arrayOfByte1, 0, arrayOfByte1.length);
/*     */     }
/* 235 */     return new QTFile(arrayOfByte1);
/*     */   }
/*     */
/*     */   public QTFile(String paramString)
/*     */   {
/* 244 */     super(paramString);
/*     */   }
/*     */
/*     */   public QTFile(File paramFile)
/*     */   {
/* 251 */     this(paramFile.getPath());
/*     */   }
/*     */
/*     */   private QTFile(byte[] paramArrayOfByte) throws QTIOException {
/* 255 */     this(spec2Path(paramArrayOfByte), paramArrayOfByte);
/*     */   }
/*     */
/*     */   private QTFile(String paramString, byte[] paramArrayOfByte)
/*     */   {
/* 260 */     super(paramString);
/* 261 */     this.fileSpec = paramArrayOfByte;
/*     */   }
/*     */
/*     */   public final byte[] getFSSpec(boolean paramBoolean, int paramInt)
/*     */     throws QTIOException
/*     */   {
/* 277 */     if (this.fileSpec == null)
/*     */       try {
/* 279 */         this.fileSpec = path2Spec(getCanonicalPath(), paramBoolean);
/*     */       } catch (IOException localIOException1) {
/* 281 */         throw new QTIOException(localIOException1.getMessage());
/*     */       }
/*     */     try
/*     */     {
/* 285 */       checkSecurity(getCanonicalPath(), paramInt);
/*     */     } catch (IOException localIOException2) {
/* 287 */       throw new QTIOException(localIOException2.getMessage());
/*     */     }
/* 289 */     byte[] arrayOfByte = new byte[this.fileSpec.length];
/* 290 */     System.arraycopy(this.fileSpec, 0, arrayOfByte, 0, arrayOfByte.length);
/* 291 */     return arrayOfByte;
/*     */   }
/*     */
/*     */   public void convertToMovieFile(QTFile paramQTFile, int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 302 */     convertToMovieFile(paramQTFile, paramInt1, paramInt2, null, null);
/*     */   }
/*     */
/*     */   public void convertToMovieFile(QTFile paramQTFile, int paramInt1, int paramInt2, MovieImporter paramMovieImporter)
/*     */     throws QTException
/*     */   {
/* 315 */     convertToMovieFile(paramQTFile, paramInt1, paramInt2, paramMovieImporter, null);
/*     */   }
/*     */
/*     */   public void convertToMovieFile(QTFile paramQTFile, int paramInt1, int paramInt2, MovieImporter paramMovieImporter, MovieProgress paramMovieProgress)
/*     */     throws QTException
/*     */   {
/* 329 */     byte[] arrayOfByte1 = getFSSpec(true, 256);
/* 330 */     byte[] arrayOfByte2 = paramQTFile.getFSSpec(false, 512);
/*     */
/* 332 */     if ((paramInt2 & 0x80000000) != 0) {
/*     */       try {
/* 334 */         checkSecurity(paramQTFile.getCanonicalPath(), 1024);
/*     */       } catch (IOException localIOException) {
/* 336 */         throw new QTIOException(localIOException.getMessage());
/*     */       }
/*     */
/*     */     }
/*     */
/* 341 */     IODispatcher localIODispatcher = null;
/* 342 */     int i = -1;
/* 343 */     if (paramMovieProgress != null) {
/* 344 */       localIODispatcher = new IODispatcher(paramMovieProgress);
/* 345 */       i = localIODispatcher.ID();
/*     */     }
/* 347 */     int j = ConvertFileToMovieFile(arrayOfByte1, arrayOfByte2, paramInt1, (short)-1, null, paramInt2, QTObject.ID(paramMovieImporter), i, 0);
/*     */
/* 356 */     if (localIODispatcher != null)
/* 357 */       localIODispatcher.cleanupMethodClosure();
/* 358 */     QTIOException.checkError(j, getPath() + "," + paramQTFile.getPath());
/*     */   }
/*     */
/*     */   public void createMovieFile(int paramInt1, int paramInt2)
/*     */     throws QTIOException
/*     */   {
/* 370 */     if ((paramInt2 & 0x80000000) != 0) {
/*     */       try {
/* 372 */         checkSecurity(getCanonicalPath(), 1024);
/*     */       } catch (IOException localIOException) {
/* 374 */         throw new QTIOException(localIOException.getMessage());
/*     */       }
/*     */     }
/*     */
/* 378 */     int i = CreateMovieFile(getFSSpec(false, 512), paramInt1, (short)-1, paramInt2 | 0x20000000 | 0x40000000, null, null);
/*     */
/* 385 */     QTIOException.checkError(i, getPath());
/*     */   }
/*     */
/*     */   public void createShortcutMovieFile(int paramInt1, int paramInt2, int paramInt3, DataRef paramDataRef)
/*     */     throws QTException
/*     */   {
/* 400 */     if (QTSession.getQTMajorVersion() < 4) {
/* 401 */       throw new QTException(-50);
/*     */     }
/* 403 */     if ((paramInt3 & 0x80000000) != 0) {
/*     */       try {
/* 405 */         checkSecurity(getCanonicalPath(), 1024);
/*     */       } catch (IOException localIOException) {
/* 407 */         throw new QTIOException(localIOException.getMessage());
/*     */       }
/*     */     }
/*     */
/* 411 */     int i = CreateShortcutMovieFile(getFSSpec(false, 512), paramInt1, (short)paramInt2, paramInt3, QTObject.ID(paramDataRef), paramDataRef.getType());
/*     */
/* 418 */     QTIOException.checkError(i, getPath());
/*     */   }
/*     */
/*     */   public AliasHandle newAlias(boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/* 428 */     return AliasHandle.fromQTFile(this, paramBoolean);
/*     */   }
/*     */
/*     */   public AliasHandle relativeAlias(QTFile paramQTFile, boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/* 439 */     return AliasHandle.fromTargetQTFile(paramQTFile, this, paramBoolean);
/*     */   }
/*     */
/*     */   public QTFile resolveAlias(boolean paramBoolean)
/*     */     throws QTIOException
/*     */   {
/* 448 */     byte b = (byte)(paramBoolean ? 1 : 0);
/* 449 */     byte[] arrayOfByte1 = { 0 };
/* 450 */     byte[] arrayOfByte2 = { 0 };
/*     */
/* 452 */     byte[] arrayOfByte3 = getFSSpec(true, 256);
/* 453 */     int i = ResolveAliasFile(arrayOfByte3, b, arrayOfByte1, arrayOfByte2);
/*     */
/* 455 */     QTIOException.checkError(i, QTUtils.PString2String(arrayOfByte3, 6));
/*     */
/* 457 */     return new QTFile(arrayOfByte3);
/*     */   }
/*     */
/*     */   public boolean delete()
/*     */   {
/* 467 */     boolean bool = false;
/*     */     try {
/* 469 */       byte[] arrayOfByte = getFSSpec(true, 1024);
/* 470 */       int i = DeleteMovieFile(arrayOfByte);
/* 471 */       QTIOException.checkError(i, getCanonicalPath());
/* 472 */       bool = true;
/*     */     } catch (IOException localIOException) {
/* 474 */       throw new SecurityException(localIOException.getMessage());
/*     */     } catch (QTException localQTException) {
/* 476 */       return super.delete();
/*     */     }
/* 478 */     return bool;
/*     */   }
/*     */
/*     */   private static final byte[] makeStdFileReply()
/*     */   {
/* 483 */     return new byte[QTSession.isCurrentOS(1) ? 88 : 280];
/*     */   }
/*     */   private static final byte[] makeFSSpec() {
/* 486 */     return new byte[QTSession.isCurrentOS(1) ? 70 : 262];
/*     */   }
/*     */
/*     */   private static byte[] path2Spec(String paramString, boolean paramBoolean)
/*     */     throws QTIOException
/*     */   {
/* 492 */     if (QTSession.isCurrentOS(4)) {
/* 493 */       if (QTSession.getJavaVersion() >= 65540) {
/* 494 */         localObject1 = new byte['ÿ'];
/* 495 */         byte[] arrayOfByte1 = new byte['ÿ'];
/*     */         try
/*     */         {
/* 499 */           byte[] arrayOfByte3 = new byte[80];
/* 500 */           byte[] arrayOfByte5 = new byte[80];
/*     */
/* 503 */           File localFile = new File(paramString);
/*     */           Object localObject3;
/*     */           Object localObject2;
/*     */           int i;
/*     */           Object localObject4;
/* 504 */           if (localFile.exists())
/*     */           {
/* 507 */             localObject3 = new int[1];
/* 508 */             int[] arrayOfInt = new int[1];
/*     */             byte[] arrayOfByte6;
/* 510 */             if ((QTSession.isCurrentOS(4)) && (EndianOrder.isNativeLittleEndian())) {
/* 511 */               localObject2 = localFile.getAbsolutePath().getBytes("UTF-16LE");
/* 512 */               arrayOfByte6 = new byte[localObject2.length];
/* 513 */               System.arraycopy(localObject2, 0, arrayOfByte6, 0, localObject2.length);
/*     */             } else {
/* 515 */               localObject2 = localFile.getAbsolutePath().getBytes("UTF-16");
/* 516 */               arrayOfByte6 = new byte[localObject2.length - 2];
/* 517 */               System.arraycopy(localObject2, 2, arrayOfByte6, 0, localObject2.length - 2);
/*     */             }
/*     */
/* 520 */             i = QTNewDataReferenceFromFullPathUnicode(arrayOfByte6, localFile.getAbsolutePath().length(), -1, 0, (int[])localObject3, arrayOfInt);
/* 521 */             if (debug) System.err.println(localFile.getAbsolutePath() + " " + i + " outDataRefType[0] " + arrayOfInt[0]);
/* 522 */             if (arrayOfInt[0] == 1634494835)
/*     */             {
/* 524 */               localObject4 = makeFSSpec();
/* 525 */               byte[] arrayOfByte7 = { 0 };
/* 526 */               int i1 = ResolveAlias(null, localObject3[0], (byte[])localObject1, arrayOfByte7);
/*     */             }
/*     */
/*     */           }
/*     */           else
/*     */           {
/* 543 */             i = FSPathMakeRef(QTUtils.String2CString(localFile.getParent()), arrayOfByte5, null);
/* 544 */             if (i == 0) {
/* 545 */               int j = FSGetCatalogInfo(arrayOfByte5, 0, 0, 0, arrayOfByte1, 0);
/*     */
/* 547 */               localObject2 = new File(paramString).getAbsolutePath();
/* 548 */               int k = ((String)localObject2).lastIndexOf(File.separator);
/* 549 */               localObject3 = ((String)localObject2).substring(0, k);
/* 550 */               int m = ((String)localObject3).lastIndexOf(File.separator);
/*     */
/* 552 */               localObject4 = ':' + ((String)localObject2).substring(m + 1, k) + ':' + ((String)localObject2).substring(k + 1, ((String)localObject2).length());
/*     */
/* 555 */               if (debug) System.err.println(j + " partialPath = " + (String)localObject4);
/*     */
/* 557 */               int n = FSMakeFSSpec(getShortFromArray(arrayOfByte1, 0), getIntFromArray(arrayOfByte1, 2), QTUtils.String2PString((String)localObject4, ((String)localObject4).length()), (byte[])localObject1);
/*     */             }
/*     */
/*     */           }
/*     */
/*     */         }
/*     */         catch (Throwable localThrowable2)
/*     */         {
/* 583 */           localThrowable2.printStackTrace();
/* 584 */           throw new QTIOException(localThrowable2.getMessage());
/*     */         }
/*     */
/* 587 */         return localObject1;
/*     */       }
/*     */       try
/*     */       {
/* 591 */         localObject1 = new FSSpec(new File(paramString));
/*     */       } catch (Throwable localThrowable1) {
/* 593 */         throw new QTIOException(localThrowable1.getMessage());
/*     */       }
/* 595 */       return ((FSSpec)localObject1).getBytes();
/*     */     }
/*     */
/* 598 */     Object localObject1 = pathName2QT(paramString);
/* 599 */     byte[] arrayOfByte2 = QTUtils.String2PString((String)localObject1, 255);
/*     */
/* 601 */     byte[] arrayOfByte4 = makeFSSpec(arrayOfByte2, paramBoolean);
/*     */     try {
/* 603 */       QTUtils.checkFreeMemory();
/*     */     } catch (UtilException localUtilException) {
/* 605 */       throw new QTIOException(-108, paramString);
/*     */     }
/* 607 */     return arrayOfByte4;
/*     */   }
/*     */
/*     */   private static String spec2Path(byte[] paramArrayOfByte)
/*     */     throws QTIOException
/*     */   {
/*     */     String str;
/* 614 */     if (QTSession.isCurrentOS(1)) {
/*     */       try {
/* 616 */         QTUtils.checkFreeMemory();
/*     */       } catch (UtilException localUtilException) {
/* 618 */         throw new QTIOException(-108, "");
/*     */       }
/* 620 */       str = MacFSSpec_getFullName(paramArrayOfByte);
/*     */     } else {
/* 622 */       str = QTUtils.PString2String(paramArrayOfByte, 6);
/*     */     }
/* 624 */     return str;
/*     */   }
/*     */
/*     */   private static final byte[] makeFSSpec(byte[] paramArrayOfByte, boolean paramBoolean) throws QTIOException
/*     */   {
/* 629 */     byte[] arrayOfByte = makeFSSpec();
/* 630 */     int i = FSMakeFSSpec((short)0, 0, paramArrayOfByte, arrayOfByte);
/* 631 */     if (i != 0) {
/* 632 */       if (i == -43) {
/* 633 */         if (paramBoolean) QTIOException.checkError(i, QTUtils.PString2String(paramArrayOfByte, 0));
/*     */
/*     */       }
/*     */       else
/*     */       {
/* 638 */         QTIOException.checkError(i, QTUtils.PString2String(paramArrayOfByte, 0));
/*     */       }
/*     */     }
/* 641 */     return arrayOfByte;
/*     */   }
/*     */
/*     */   private static String pathName2QT(String paramString)
/*     */     throws QTIOException
/*     */   {
/* 648 */     if (paramString.charAt(0) == '/') {
/* 649 */       paramString = paramString.substring(1);
/*     */     }
/* 651 */     if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4))) {
/* 652 */       paramString = MacFSSpec_pathName2QT(paramString);
/* 653 */       paramString = cleanUpPathName(paramString);
/* 654 */       paramString = MacFSSpec_checkAndResolveAlias(paramString);
/* 655 */     } else if (QTSession.isCurrentOS(2)) {
/* 656 */       paramString = paramString.replace('/', File.separatorChar);
/*     */     }
/*     */
/* 659 */     return paramString;
/*     */   }
/*     */
/*     */   private static final String cleanUpPathName(String paramString)
/*     */   {
/* 664 */     int i = paramString.length();
/* 665 */     StringBuffer localStringBuffer = new StringBuffer();
/*     */
/* 667 */     for (int j = 0; j < i; j++)
/*     */     {
/* 669 */       if (paramString.charAt(j) == '%') {
/* 670 */         String str = paramString.substring(j + 1, j + 3);
/* 671 */         localStringBuffer.append((char)Integer.parseInt(str, 16));
/* 672 */         j += 2;
/*     */       }
/*     */       else {
/* 675 */         localStringBuffer.append(paramString.charAt(j));
/*     */       }
/*     */     }
/* 678 */     return new String(localStringBuffer);
/*     */   }
/*     */
/*     */   private static String MacFSSpec_pathName2QT(String paramString) {
/* 682 */     if ((paramString.charAt(0) == ':') || (paramString.charAt(0) == '/')) {
/* 683 */       paramString = paramString.substring(1);
/*     */     }
/* 685 */     return paramString.replace('/', ':');
/*     */   }
/*     */
/*     */   private static String MacFSSpec_checkAndResolveAlias(String paramString) throws QTIOException {
/*     */     try {
/* 690 */       QTUtils.checkFreeMemory();
/*     */     } catch (QTException localQTException) {
/* 692 */       throw new QTIOException(-108, paramString);
/*     */     }
/* 694 */     byte[] arrayOfByte1 = new byte[paramString.length() + 1];
/* 695 */     byte[] arrayOfByte2 = paramString.getBytes();
/*     */     int i;
/* 698 */     if (QTSession.isCurrentOS(1))
/* 699 */       i = arrayOfByte2.length;
/*     */     else {
/* 701 */       i = paramString.length();
/*     */     }
/* 703 */     System.arraycopy(arrayOfByte2, 0, arrayOfByte1, 1, arrayOfByte2.length);
/* 704 */     arrayOfByte1[0] = ((byte)i);
/* 705 */     byte[] arrayOfByte3 = new byte[70];
/*     */
/* 708 */     if (FSMakeFSSpec((short)0, 0, arrayOfByte1, arrayOfByte3) == -120) {
/* 709 */       String str1 = paramString.substring(0, paramString.lastIndexOf(':'));
/* 710 */       arrayOfByte2 = paramString.getBytes();
/* 711 */       System.arraycopy(arrayOfByte2, 0, arrayOfByte1, 1, i);
/*     */
/* 713 */       if (QTSession.isCurrentOS(1))
/* 714 */         arrayOfByte1[0] = ((byte)str1.getBytes().length);
/*     */       else
/* 716 */         arrayOfByte1[0] = ((byte)str1.length());
/* 717 */       FSMakeFSSpec((short)0, 0, arrayOfByte1, arrayOfByte3);
/*     */
/* 719 */       int[] arrayOfInt = { 0 };
/* 720 */       byte[] arrayOfByte4 = { 0 };
/* 721 */       byte[] arrayOfByte5 = { 0 };
/* 722 */       int j = ResolveAliasFile(arrayOfByte3, (byte)1, arrayOfByte4, arrayOfByte5);
/* 723 */       if ((j == 0) || (j == -43)) {
/* 724 */         if (arrayOfByte5[0] != 0) {
/* 725 */           String str2 = "";
/*     */
/* 727 */           str2 = MacFSSpec_getFullName(arrayOfByte3);
/* 728 */           str2 = MacFSSpec_pathName2QT(str2);
/*     */
/* 732 */           str2 = str2 + paramString.substring(paramString.lastIndexOf(':'));
/* 733 */           return str2;
/*     */         }
/*     */       }
/* 736 */       else throw new QTIOException(j, paramString);
/*     */     }
/* 738 */     return paramString;
/*     */   }
/*     */
/*     */   private static String MacFSSpec_getFullName(byte[] paramArrayOfByte)
/*     */     throws QTIOException
/*     */   {
/* 887 */     CInfoPBRec localCInfoPBRec = new CInfoPBRec();
/* 888 */     localCInfoPBRec.setVRefNum(getShortFromArray(paramArrayOfByte, 0));
/* 889 */     localCInfoPBRec.setNamePtr(getPStringAt(paramArrayOfByte, 6));
/* 890 */     localCInfoPBRec.setFileDirIndex((short)-1);
/* 891 */     localCInfoPBRec.setFileDirID(getIntFromArray(paramArrayOfByte, 2));
/*     */
/* 893 */     Object localObject = new String(getPStringAt(paramArrayOfByte, 6));
/* 894 */     int i = getIntFromArray(paramArrayOfByte, 2);
/*     */     while (true)
/*     */     {
/* 898 */       String str = "";
/* 899 */       localCInfoPBRec.setFileDirID(i);
/* 900 */       int j = PBGetCatInfoSync(localCInfoPBRec.getBytes());
/* 901 */       QTIOException.checkError(j, (String)localObject);
/* 902 */       if (localCInfoPBRec.getFileDirID() == 2) {
/* 903 */         str = localCInfoPBRec.getName();
/* 904 */         str = str + File.separator;
/* 905 */         str = str + (String)localObject;
/* 906 */         localObject = str;
/* 907 */         str = File.separator;
/* 908 */         str = str + (String)localObject;
/* 909 */         localObject = str;
/* 910 */         break;
/*     */       }
/* 912 */       i = localCInfoPBRec.getDirParID();
/* 913 */       str = localCInfoPBRec.getName();
/* 914 */       str = str + File.separator;
/* 915 */       str = str + (String)localObject;
/* 916 */       localObject = str;
/*     */     }
/* 918 */     return localObject;
/*     */   }
/*     */
/*     */   private static String getPStringAt(byte[] paramArrayOfByte, int paramInt) {
/* 922 */     int i = paramArrayOfByte[(paramInt++)];
/* 923 */     byte[] arrayOfByte = new byte[i];
/* 924 */     System.arraycopy(paramArrayOfByte, paramInt, arrayOfByte, 0, i);
/* 925 */     return new String(arrayOfByte);
/*     */   }
/*     */
/*     */   private static native short QTNewDataReferenceFromFullPathUnicode(byte[] paramArrayOfByte, int paramInt1, int paramInt2, int paramInt3, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/*     */
/*     */   private static native short getShortFromArray(byte[] paramArrayOfByte, int paramInt);
/*     */
/*     */   private static native int getIntFromArray(byte[] paramArrayOfByte, int paramInt);
/*     */
/*     */   private static native void copyPointerToArray(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4);
/*     */
/*     */   private static native int NewPtrClear(int paramInt);
/*     */
/*     */   private static native void DisposePtr(int paramInt);
/*     */
/*     */   private static native short FSMakeFSSpec(short paramShort, int paramInt, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2);
/*     */
/*     */   private static native short PBGetCatInfoSync(byte[] paramArrayOfByte);
/*     */
/*     */   private static native short ResolveAlias(byte[] paramArrayOfByte1, int paramInt, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3);
/*     */
/*     */   private static native short ResolveAliasFile(byte[] paramArrayOfByte1, byte paramByte, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3);
/*     */
/*     */   private static native short FSPathMakeRef(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3);
/*     */
/*     */   private static native int FSGetCatalogInfo(byte[] paramArrayOfByte1, int paramInt1, int paramInt2, int paramInt3, byte[] paramArrayOfByte2, int paramInt4);
/*     */
/*     */   private static native short FSMakeFSRefUnicode(byte[] paramArrayOfByte1, int paramInt1, byte[] paramArrayOfByte2, int paramInt2, byte[] paramArrayOfByte3);
/*     */
/*     */   private static native int GraphicsImportGetDataFile(int paramInt, byte[] paramArrayOfByte);
/*     */
/*     */   private static native int GraphicsExportGetInputFile(int paramInt, byte[] paramArrayOfByte);
/*     */
/*     */   private static native int GraphicsExportGetOutputFile(int paramInt, byte[] paramArrayOfByte);
/*     */
/*     */   private static native int GraphicsImportDoExportImageFileDialog(int paramInt1, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, int paramInt2, int[] paramArrayOfInt, byte[] paramArrayOfByte3, short[] paramArrayOfShort);
/*     */
/*     */   private static native int SGGetDataOutput(int paramInt, byte[] paramArrayOfByte, int[] paramArrayOfInt);
/*     */
/*     */   private static native short ConvertFileToMovieFile(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, int paramInt1, short paramShort, short[] paramArrayOfShort, int paramInt2, int paramInt3, int paramInt4, int paramInt5);
/*     */
/*     */   private static native void StandardGetFilePreview(int paramInt, short paramShort, int[] paramArrayOfInt, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short DeleteMovieFile(byte[] paramArrayOfByte);
/*     */
/*     */   private static native short CreateMovieFile(byte[] paramArrayOfByte, int paramInt1, short paramShort, int paramInt2, short[] paramArrayOfShort, int[] paramArrayOfInt);
/*     */
/*     */   private static native short CreateShortcutMovieFile(byte[] paramArrayOfByte, int paramInt1, short paramShort, int paramInt2, int paramInt3, int paramInt4);
/*     */
/*     */   private static class CInfoPBRec extends QTByteObject
/*     */   {
/*     */     CInfoPBRec()
/*     */     {
/* 814 */       super();
/*     */     }
/*     */
/*     */     short getVRefNum()
/*     */     {
/* 820 */       return getShortAt(22);
/*     */     }
/*     */
/*     */     String getName() throws QTIOException {
/* 824 */       return getPString(getIntAt(18));
/*     */     }
/*     */
/*     */     int getFileDirID() {
/* 828 */       return getIntAt(48);
/*     */     }
/*     */     int getDirParID() {
/* 831 */       return getIntAt(100);
/*     */     }
/*     */
/*     */     void setVRefNum(short paramShort) {
/* 835 */       setShortAt(22, paramShort);
/*     */     }
/*     */
/*     */     void setNamePtr(String paramString) throws QTIOException {
/* 839 */       if (paramString.length() > 255) throw new QTIOException(-50, paramString);
/* 840 */       int i = QTFile.NewPtrClear(256);
/* 841 */       if (i == 0) throw new QTIOException(-108, paramString);
/*     */
/* 843 */       byte[] arrayOfByte = paramString.getBytes();
/*     */       int j;
/* 845 */       if (QTSession.isCurrentOS(1))
/* 846 */         j = arrayOfByte.length;
/*     */       else
/* 848 */         j = paramString.length();
/* 849 */       setByteInPointer(i, 0, (byte)j);
/*     */
/* 852 */       copyArrayToPointer(arrayOfByte, 0, i, 1, j);
/* 853 */       setByteInPointer(i, 0, (byte)j);
/* 854 */       setIntAt(18, i);
/*     */     }
/*     */
/*     */     void setFileDirID(int paramInt) {
/* 858 */       setIntAt(48, paramInt);
/*     */     }
/*     */     void setFileDirIndex(short paramShort) {
/* 861 */       setShortAt(28, paramShort);
/*     */     }
/*     */     protected final void finalize() throws Throwable {
/* 864 */       if (getIntAt(18) != 0) QTFile.DisposePtr(getIntAt(18));
/* 865 */       super.finalize();
/*     */     }
/*     */
/*     */     private String getPString(int paramInt) {
/* 869 */       int i = getByteFromPointer(paramInt, 0);
/* 870 */       byte[] arrayOfByte = new byte[i];
/* 871 */       copyPointerToArray(paramInt, 1, arrayOfByte, 0, i);
/* 872 */       return new String(arrayOfByte);
/*     */     }
/*     */
/*     */     private static native void copyArrayToPointer(byte[] paramArrayOfByte, int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/*     */
/*     */     private static native void copyPointerToArray(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4);
/*     */
/*     */     private static native void setByteInPointer(int paramInt1, int paramInt2, byte paramByte);
/*     */
/*     */     private static native byte getByteFromPointer(int paramInt1, int paramInt2);
/*     */
/*     */     static
/*     */     {
/* 744 */       if (!QTSession.isCurrentOS(1))
/* 745 */         throw new QTRuntimeException("Class Not Required");
/*     */     }
/*     */   }
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.io.QTFile
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.io.QTFile$CInfoPBRec

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.