Package quicktime.std.qtcomponents

Source Code of quicktime.std.qtcomponents.XMLElement

/*     */ package quicktime.std.qtcomponents;
/*     */
/*     */ import java.io.PrintStream;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.std.StdQTException;
/*     */ import quicktime.util.QTUtils;
/*     */ import quicktime.util.UtilException;
/*     */
/*     */ public final class XMLElement extends QTObject
/*     */ {
/*  31 */   private static boolean apriori = QTSession.apriori();
/*     */
/*  35 */   private static Object owner = new Object();
/*     */   private static final int kXMLElementSize = 16;
/*     */   private static final int kIdentifierOffset = 0;
/*     */   private static final int kNameOffset = 4;
/*     */   private static final int kAttributesOffset = 8;
/*     */   private static final int kContentsOffset = 12;
/*     */
/*     */   XMLElement(int paramInt)
/*     */     throws QTException
/*     */   {
/*  51 */     super(paramInt, owner);
/*     */   }
/*     */
/*     */   public int getIdentifier()
/*     */     throws StdQTException
/*     */   {
/*  64 */     int i = getIntFromPointer(_ID(), 0);
/*  65 */     if (i != -1) {
/*  66 */       return i;
/*     */     }
/*  68 */     System.out.println("XMLElement.getIdentifier() called but is xmlIdentifierUnrecognized");
/*  69 */     throw new StdQTException(-50);
/*     */   }
/*     */
/*     */   public boolean identifierUnrecognized()
/*     */   {
/*  77 */     int i = getIntFromPointer(_ID(), 0);
/*  78 */     return i == -1;
/*     */   }
/*     */
/*     */   public String getName()
/*     */     throws StdQTException, UtilException
/*     */   {
/*  87 */     int i = getIntFromPointer(_ID(), 0);
/*  88 */     if (i == -1) {
/*  89 */       int j = getIntFromPointer(_ID(), 4);
/*  90 */       String str = getStringFromPointer(j);
/*  91 */       return str;
/*     */     }
/*  93 */     System.out.println("XMLElement.getName() called but not xmlIdentifierUnrecognized");
/*  94 */     throw new StdQTException(-50);
/*     */   }
/*     */
/*     */   public int countAttributes()
/*     */     throws StdQTException, QTException
/*     */   {
/* 102 */     int i = getIntFromPointer(_ID(), 8);
/* 103 */     if (i != 0) {
/* 104 */       XMLAttribute localXMLAttribute = new XMLAttribute(i);
/* 105 */       for (int j = 0; ; j++) {
/* 106 */         if (localXMLAttribute.getNthIdentifier(j) == 0) {
/* 107 */           return j;
/*     */         }
/*     */       }
/*     */     }
/* 111 */     return 0;
/*     */   }
/*     */
/*     */   public XMLAttribute[] getAttributes()
/*     */     throws StdQTException, QTException
/*     */   {
/* 119 */     int i = countAttributes();
/* 120 */     if (i != 0) {
/* 121 */       XMLAttribute[] arrayOfXMLAttribute = new XMLAttribute[i];
/* 122 */       int j = getIntFromPointer(_ID(), 8);
/* 123 */       for (int k = 0; k < i; k++) {
/* 124 */         arrayOfXMLAttribute[k] = new XMLAttribute(j, k);
/*     */       }
/* 126 */       return arrayOfXMLAttribute;
/*     */     }
/* 128 */     return null;
/*     */   }
/*     */
/*     */   public int countContents()
/*     */     throws StdQTException, QTException
/*     */   {
/* 136 */     int i = getIntFromPointer(_ID(), 12);
/* 137 */     if (i != 0) {
/* 138 */       XMLContent localXMLContent = new XMLContent(i);
/* 139 */       for (int j = 0; ; j++) {
/* 140 */         if (localXMLContent.getNthIdentifier(j) == 0) {
/* 141 */           return j;
/*     */         }
/*     */       }
/*     */     }
/* 145 */     return 0;
/*     */   }
/*     */
/*     */   public XMLContent[] getContents()
/*     */     throws StdQTException, QTException
/*     */   {
/* 153 */     int i = countContents();
/* 154 */     if (i != 0) {
/* 155 */       int j = getIntFromPointer(_ID(), 12);
/* 156 */       XMLContent[] arrayOfXMLContent = new XMLContent[i];
/* 157 */       for (int k = 0; k < i; k++) {
/* 158 */         arrayOfXMLContent[k] = new XMLContent(j, k);
/*     */       }
/* 160 */       return arrayOfXMLContent;
/*     */     }
/* 162 */     return null;
/*     */   }
/*     */
/*     */   private String getStringFromPointer(int paramInt)
/*     */   {
/* 169 */     if (paramInt != 0) {
/* 170 */       int i = 0;
/* 171 */       int j = 0;
/* 172 */       while (getByteFromPointer(paramInt, j++) != 0) {
/* 173 */         i++;
/*     */       }
/* 175 */       byte[] arrayOfByte = new byte[i];
/* 176 */       copyPointerToArray(paramInt, 0, arrayOfByte, 0, i);
/* 177 */       return QTUtils.CString2String(arrayOfByte, 0);
/*     */     }
/* 179 */     return "";
/*     */   }
/*     */
/*     */   private static native byte getByteFromPointer(int paramInt1, int paramInt2);
/*     */
/*     */   private static native int getIntFromPointer(int paramInt1, int paramInt2);
/*     */
/*     */   private static native void copyPointerToArray(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4);
/*     */ }

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

Related Classes of quicktime.std.qtcomponents.XMLElement

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.