Java 类javax.sound.midi.MidiFileFormat 实例源码

项目:OpenJSharp    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:OpenJSharp    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:jdk8u-jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk8u-jdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:openjdk-jdk10    文件:StandardMidiFileReader.java   
@Override
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk-jdk10    文件:StandardMidiFileReader.java   
@Override
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:openjdk9    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk9    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:jdk8u_jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk8u_jdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:lookaside_java-1.8.0-openjdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:lookaside_java-1.8.0-openjdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:infobip-open-jdk-8    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:infobip-open-jdk-8    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:jdk8u-dev-jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk8u-dev-jdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:jdk7-jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk7-jdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:openjdk-source-code-learn    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk-source-code-learn    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:OLD-OpenJDK8    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:OLD-OpenJDK8    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:openjdk-jdk7u-jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk-jdk7u-jdk    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:openjdk-icedtea7    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);

    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
    long length = file.length();
    if (length > Integer.MAX_VALUE) {
        length = MidiFileFormat.UNKNOWN_LENGTH;
    }
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormatFromStream(bis, (int) length, null);
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk-icedtea7    文件:StandardMidiFileReader.java   
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
    SMFParser smfParser = new SMFParser();
    MidiFileFormat format = getMidiFileFormatFromStream(stream,
                                                        MidiFileFormat.UNKNOWN_LENGTH,
                                                        smfParser);

    // must be MIDI Type 0 or Type 1
    if ((format.getType() != 0) && (format.getType() != 1)) {
        throw new InvalidMidiDataException("Invalid or unsupported file type: "  + format.getType());
    }

    // construct the sequence object
    Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution());

    // for each track, go to the beginning and read the track events
    for (int i = 0; i < smfParser.tracks; i++) {
        if (smfParser.nextTrack()) {
            smfParser.readTrack(sequence.createTrack());
        } else {
            break;
        }
    }
    return sequence;
}
项目:OpenJSharp    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:OpenJSharp    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk8u-jdk    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:jdk8u-jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk-jdk10    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:openjdk-jdk10    文件:StandardMidiFileReader.java   
@Override
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:openjdk9    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:openjdk9    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:jdk8u_jdk    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:jdk8u_jdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:lookaside_java-1.8.0-openjdk    文件:JavaSoundAudioClip.java   
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:StandardMidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
    InputStream urlStream = url.openStream(); // throws IOException
    BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
    MidiFileFormat fileFormat = null;
    try {
        fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException
    } finally {
        bis.close();
    }
    return fileFormat;
}
项目:javify    文件:MidiFileReader.java   
public MidiFileFormat getMidiFileFormat(URL url)
  throws InvalidMidiDataException, IOException
{
  InputStream is = url.openStream();
  try
    {
      return getMidiFileFormat(is);
    }
  finally
    {
      is.close();
    }
}
项目:javify    文件:MidiFileReader.java   
public MidiFileFormat getMidiFileFormat(File file)
  throws InvalidMidiDataException, IOException
{
  InputStream is = new FileInputStream(file);
  try
    {
      return getMidiFileFormat(is);
    }
  finally
    {
      is.close();
    }
}