Package quicktime.util

Source Code of quicktime.util.EndianDescriptor

/*     */ package quicktime.util;
/*     */
/*     */ import java.util.Enumeration;
/*     */ import java.util.Vector;
/*     */ import quicktime.QTRuntimeException;
/*     */
/*     */ public class EndianDescriptor
/*     */ {
/*     */   public static final int kFlipSpecifiedFields = 0;
/*     */   public static final int kFlipAllFields16 = 1;
/*     */   public static final int kFlipAllFields32 = 16;
/*     */   public static final int kFlipAllFields64 = 256;
/*     */   public static final int kFlipNoFields = 4096;
/*  53 */   public static final EndianDescriptor flipAll16 = new EndianDescriptor(1);
/*     */
/*  56 */   public static final EndianDescriptor flipAll32 = new EndianDescriptor(16);
/*     */
/*  59 */   public static final EndianDescriptor flipAll64 = new EndianDescriptor(256);
/*     */   private int flag;
/*     */   private Vector vec;
/*     */
/*     */   public EndianDescriptor(int paramInt)
/*     */   {
/*  66 */     this.flag = paramInt;
/*     */   }
/*     */
/*     */   public int getFormatFlag()
/*     */   {
/*  79 */     return this.flag;
/*     */   }
/*     */
/*     */   public void addFlipSpec(EndianFlipSpec paramEndianFlipSpec)
/*     */   {
/* 102 */     if (this.flag != 0) {
/* 103 */       throw new QTRuntimeException("Can't specify endian flip with " + this.flag + " format flag");
/*     */     }
/* 105 */     if (this.vec == null) {
/* 106 */       this.vec = new Vector();
/*     */     }
/* 108 */     for (int i = 0; i < this.vec.size(); i++) {
/* 109 */       EndianFlipSpec localEndianFlipSpec = (EndianFlipSpec)this.vec.elementAt(i);
/* 110 */       if (paramEndianFlipSpec.offset == localEndianFlipSpec.offset)
/* 111 */         throw new QTRuntimeException("Each offset must be unique");
/* 112 */       if (paramEndianFlipSpec.offset < localEndianFlipSpec.offset) {
/* 113 */         this.vec.insertElementAt(paramEndianFlipSpec, i);
/* 114 */         return;
/*     */       }
/*     */     }
/* 117 */     this.vec.addElement(paramEndianFlipSpec);
/*     */   }
/*     */
/*     */   public void removeFlipSpec(EndianFlipSpec paramEndianFlipSpec)
/*     */   {
/* 125 */     if (this.vec != null)
/* 126 */       this.vec.removeElement(paramEndianFlipSpec);
/*     */   }
/*     */
/*     */   public EndianFlipSpec getFlipSpec(int paramInt)
/*     */   {
/* 137 */     if (this.vec == null) return null;
/* 138 */     for (int i = 0; i < this.vec.size(); i++) {
/* 139 */       EndianFlipSpec localEndianFlipSpec = (EndianFlipSpec)this.vec.elementAt(i);
/* 140 */       if (paramInt == localEndianFlipSpec.offset)
/* 141 */         return localEndianFlipSpec;
/* 142 */       if (localEndianFlipSpec.offset > paramInt)
/* 143 */         return null;
/*     */     }
/* 145 */     return null;
/*     */   }
/*     */
/*     */   public Enumeration flipSpecs()
/*     */   {
/* 153 */     return this.vec == null ? null : this.vec.elements();
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 161 */     String str = getClass().getName() + "[flipFlag=";
/* 162 */     switch (this.flag) { case 0:
/* 163 */       str = str + "kFlipSpecifiedFields"; break;
/*     */     case 1:
/* 164 */       str = str + "kFlipAllFields16"; break;
/*     */     case 16:
/* 165 */       str = str + "kFlipAllFields32"; break;
/*     */     case 256:
/* 166 */       str = str + "kFlipAllFields64"; break;
/*     */     case 4096:
/* 167 */       str = str + "kFlipNoFields";
/*     */     }
/* 169 */     if (this.flag == 0) {
/* 170 */       str = str + "[";
/* 171 */       Enumeration localEnumeration = flipSpecs();
/* 172 */       while (localEnumeration.hasMoreElements())
/* 173 */         str = str + localEnumeration.nextElement() + ",";
/* 174 */       str = str + "]";
/*     */     }
/* 176 */     str = str + "]";
/* 177 */     return str;
/*     */   }
/*     */ }

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

Related Classes of quicktime.util.EndianDescriptor

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.