如何将InputStream转换为文件?

时间:2013-06-07 08:38:55

标签: java inputstream html5-audio fileinputstream audio-converter

我从webService接收一个InputStream然后我将使用HTML5标签播放,所以为了播放音频,我需要将InputStream转换为URL,这样标签可以读取此流,因为它已经读取了的InputStream。

   <!DOCTYPE html>
<%@page import="yourphone.voicemail.*"%>
<%@page import="com.verscom.ws.*"%>
<%@page import="com.verscom.methods.*"%>

<body>
    <button onclick="playSound()">Play Me</button>
    <button onclick="pausrSound()">Pause</button>
    <audio id="audio" controls="controls">
        <source id="mainSrc" type="audio/mp3" onplay="playSound()"></source>
    </audio>
</body>


<script type="text/javascript"> 
var audio = document.getElementById("audio");

function playSound(){ 
<% 
EndUserPortalWSServiceStub.GetVoiceMailMessageVcomResponse[] getvmMsgResp = new EndUserPortalWSServiceStub.GetVoiceMailMessageVcomResponse[2];
EndUserMethods endUserMethods = new EndUserMethods();
getvmMsgResp = endUserMethods.getVoiceMailList();

%>
audio.src= <%=getvmMsgResp[0].getVmailMessageWAVFile().getDataSource().getInputStream().toString()%>;
audio.play(); }

function pausrSound(){ audio.pause(); }

</script>

0 个答案:

没有答案