- 更新日時:
- 2010/05/11 20:15:55 (2 年 前)
- パス:
- trunk/src/org/rayflood/mikuvat/io/midi
- ファイル:
-
- 1 追加
- 1 移動
-
. (追加)
-
MidiMeta.java (移動) (移動元: trunk/src/org/rayflood/mikuvat/io/MidiMeta.java) (7 diff)
凡例:
- 変更なし
- 追加
- 削除
-
trunk/src/org/rayflood/mikuvat/io/midi/MidiMeta.java
r2 r4 1 package org.rayflood.mikuvat.io ;1 package org.rayflood.mikuvat.io.midi; 2 2 3 import static org.rayflood.mikuvat. io.VSQDecoder.getByteArrayString;3 import static org.rayflood.mikuvat.Utilities.getByteArrayString; 4 4 5 5 import java.io.File; 6 import java.io.FileNotFoundException; 7 import java.io.IOException; 6 8 import java.util.ArrayList; 7 9 import java.util.List; 8 10 11 import javax.sound.midi.InvalidMidiDataException; 9 12 import javax.sound.midi.MetaMessage; 10 13 import javax.sound.midi.MidiMessage; 14 15 import org.rayflood.mikuvat.io.BaseObject; 11 16 12 17 public class MidiMeta extends MidiData{ … … 15 20 private byte[] data; 16 21 17 p ublicMidiMeta(MidiMessage mm){22 protected MidiMeta(MidiMessage mm){ 18 23 setMidiEvent(mm); 24 } 25 26 public MidiMeta(MetaMessage meta){ 27 setMidiEvent(meta); 19 28 } 20 29 … … 24 33 } 25 34 26 public MetaMessage getMidiEvent() throws Exception{35 public MetaMessage getMidiEvent() throws InvalidMidiDataException{ 27 36 MetaMessage meta = new MetaMessage(); 28 37 meta.setMessage(getType(), getData(), getData().length); … … 30 39 } 31 40 32 public void setMidiEvent(MidiMessage mm){ 33 MetaMessage meta = (MetaMessage)mm; 41 protected void setMidiEvent(MidiMessage mm){ 42 setMidiEvent((MetaMessage)mm); 43 } 44 45 public void setMidiEvent(MetaMessage meta){ 34 46 setType(meta.getType()); 35 47 setData(meta.getData()); … … 41 53 sl.add("Data=" + getByteArrayString(getData())); 42 54 43 StringBu ffer sb = new StringBuffer();55 StringBuilder sb = new StringBuilder(); 44 56 sb.append("MidiMeta={"); 45 57 if(!sl.isEmpty()){ … … 53 65 } 54 66 55 public boolean isReadied(){67 public boolean validate(){ 56 68 return true; 57 69 } 58 70 59 public int compareTo( ImmutableObject obj){71 public int compareTo(BaseObject obj){ 60 72 MidiMeta midiMeta = (MidiMeta)obj; 61 73 return compare(getType(), midiMeta.getType()); 62 74 } 63 75 64 public MidiMeta over( Object obj, boolean fill, boolean has){76 public MidiMeta over(BaseObject obj, boolean fill, boolean has){ 65 77 MidiMeta midiMeta = ((MidiMeta)obj).clone(); 66 78 setType(midiMeta.getType()); … … 112 124 } 113 125 114 public static MidiMeta load(String file) throws Exception{115 return (MidiMeta) ImmutableObject.load(file);126 public static MidiMeta load(String file) throws FileNotFoundException, IOException, ClassNotFoundException{ 127 return (MidiMeta)BaseObject.load(file); 116 128 } 117 129 118 public static MidiMeta load(File file) throws Exception{119 return (MidiMeta) ImmutableObject.load(file);130 public static MidiMeta load(File file) throws FileNotFoundException, IOException, ClassNotFoundException{ 131 return (MidiMeta)BaseObject.load(file); 120 132 } 121 133 122 public void store(String file) throws Exception{134 public void store(String file) throws FileNotFoundException, IOException{ 123 135 super.store(file); 124 136 } 125 137 126 public void store(File file) throws Exception{138 public void store(File file) throws FileNotFoundException, IOException{ 127 139 super.store(file); 128 140 } 129 141 130 public static MidiMeta unzip(String file) throws Exception{131 return (MidiMeta) ImmutableObject.unzip(file);142 public static MidiMeta unzip(String file) throws IOException, ClassNotFoundException{ 143 return (MidiMeta)BaseObject.unzip(file); 132 144 } 133 145 134 public static MidiMeta unzip(File file) throws Exception{135 return (MidiMeta) ImmutableObject.unzip(file);146 public static MidiMeta unzip(File file) throws IOException, ClassNotFoundException{ 147 return (MidiMeta)BaseObject.unzip(file); 136 148 } 137 149 138 public void zip(String file) throws Exception{150 public void zip(String file) throws IOException{ 139 151 super.zip(file); 140 152 } 141 153 142 public void zip(File file) throws Exception{154 public void zip(File file) throws IOException{ 143 155 super.zip(file); 144 156 }
