1 7 8 package javax.sound.midi; 9 10 import java.io.InputStream ; 11 import java.io.IOException ; 12 import java.util.Collections ; 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 17 74 75 public class MidiFileFormat { 76 77 78 83 public static final int UNKNOWN_LENGTH = -1; 84 85 86 89 protected int type; 90 91 100 protected float divisionType; 101 102 105 protected int resolution; 106 107 110 protected int byteLength; 111 112 115 protected long microsecondLength; 116 117 118 119 private HashMap <String , Object > properties; 120 121 122 137 public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds) { 138 139 this.type = type; 140 this.divisionType = divisionType; 141 this.resolution = resolution; 142 this.byteLength = bytes; 143 this.microsecondLength = microseconds; 144 this.properties = null; 145 } 146 147 148 170 public MidiFileFormat(int type, float divisionType, 171 int resolution, int bytes, 172 long microseconds, Map <String , Object > properties) { 173 this(type, divisionType, resolution, bytes, microseconds); 174 this.properties = new HashMap <String , Object >(properties); 175 } 176 177 178 179 183 public int getType() { 184 return type; 185 } 186 187 200 public float getDivisionType() { 201 return divisionType; 202 } 203 204 205 214 public int getResolution() { 215 return resolution; 216 } 217 218 219 224 public int getByteLength() { 225 return byteLength; 226 } 227 228 235 public long getMicrosecondLength() { 236 return microsecondLength; 237 } 238 239 251 public Map <String ,Object > properties() { 252 Map <String ,Object > ret; 253 if (properties == null) { 254 ret = new HashMap <String ,Object >(0); 255 } else { 256 ret = (Map <String ,Object >) (properties.clone()); 257 } 258 return (Map <String ,Object >) Collections.unmodifiableMap(ret); 259 } 260 261 262 278 public Object getProperty(String key) { 279 if (properties == null) { 280 return null; 281 } 282 return properties.get(key); 283 } 284 285 286 } 287 288 | Popular Tags |