本文整理汇总了Java中java.io.PipedInputStream.connect方法的典型用法代码示例。如果您正苦于以下问题:Java PipedInputStream.connect方法的具体用法?Java PipedInputStream.connect怎么用?Java PipedInputStream.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PipedInputStream
的用法示例。
在下文中一共展示了PipedInputStream.connect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import java.io.PipedInputStream; //导入方法依赖的package包/类
public void setup(AbstractCliArgs args, Mic m, MixingOutput player, int frameSamples) throws IOException {
bufferSize=frameSamples*2;
int pipeSize=(Math.abs(nLate)+100)*bufferSize;
play=new PipedInputStream(pipeSize);
play.connect(playSink);
rec=new PipedInputStream(pipeSize);
rec.connect(recSink);
Process p=new ProcessBuilder(args.program_speexcmd, "cancelecho", ""+frameSamples, ""+(int)StreamSourceAudio.getFormat().getFrameRate()).start();
speexInputMic=p.getOutputStream();
speexInputMonitor=p.getOutputStream();
speexOutput=p.getInputStream();
SpeexResampler.checkSpeexCmdVersion(p, speexOutput);
if(log)
{
speexInputMic=new TeeOutputStream(new OutputStream[]{speexInputMic, new FileOutputStream("/tmp/mic.sw")});
speexInputMonitor=new TeeOutputStream(new OutputStream[]{speexInputMonitor, new FileOutputStream("/tmp/monitor.sw")});
}
ConnectStreams.startStreamThread(p.getErrorStream(), System.err);
player.setSpeexCopy(playSink);
m.setSpeexCopy(recSink);
System.out.println("Speex buffer size: "+bufferSize);
}
示例2: setup
import java.io.PipedInputStream; //导入方法依赖的package包/类
public void setup(Mic m, Play player, int frameSamples) throws IOException {
bufferSize=frameSamples*2;
int pipeSize=(Math.abs(nLate)+100)*bufferSize;
play=new PipedInputStream(pipeSize);
play.connect(playSink);
rec=new PipedInputStream(pipeSize);
rec.connect(recSink);
Process p;
p=Runtime.getRuntime().exec("/home/rizsi/github/rcom/speexexample/a.out");
speexInputMic=p.getOutputStream();
speexInputMonitor=p.getOutputStream();
speexOutput=p.getInputStream();
if(log)
{
speexInputMic=new TeeOutputStream(new OutputStream[]{speexInputMic, new FileOutputStream("/tmp/mic.sw")});
speexInputMonitor=new TeeOutputStream(new OutputStream[]{speexInputMonitor, new FileOutputStream("/tmp/monitor.sw")});
}
ConnectStreams.startStreamThread(p.getErrorStream(), System.err);
player.setSpeexCopy(playSink);
m.setSpeexCopy(recSink);
System.out.println("Speex buffer size: "+bufferSize);
}
示例3: MicrophoneInputStream
import java.io.PipedInputStream; //导入方法依赖的package包/类
/**
* Instantiates a new microphone input stream.
*
* @param opusEncoded the opus encoded
*/
public MicrophoneInputStream(boolean opusEncoded) {
captureThread = new MicrophoneCaptureThread(this, opusEncoded);
if (opusEncoded == true) {
CONTENT_TYPE = ContentType.OPUS;
} else {
CONTENT_TYPE = ContentType.RAW;
}
os = new PipedOutputStream();
is = new PipedInputStream();
try {
is.connect(os);
} catch (IOException e) {
Log.e(TAG, e.getMessage());
}
captureThread.start();
}
示例4: setup
import java.io.PipedInputStream; //导入方法依赖的package包/类
@Before public void setup() throws IOException {
PipedInputStream inClient = new PipedInputStream();
PipedOutputStream outClient = new PipedOutputStream();
PipedInputStream inServer = new PipedInputStream();
PipedOutputStream outServer = new PipedOutputStream();
inClient.connect(outServer);
outClient.connect(inServer);
server = new AssertingEndpoint();
serverLauncher = LSPLauncher.createServerLauncher(ServiceEndpoints.toServiceObject(server, LanguageServer.class), inServer, outServer);
serverListening = serverLauncher.startListening();
client = new AssertingEndpoint();
clientLauncher = LSPLauncher.createClientLauncher(ServiceEndpoints.toServiceObject(client, LanguageClient.class), inClient, outClient);
clientListening = clientLauncher.startListening();
}
示例5: wrap
import java.io.PipedInputStream; //导入方法依赖的package包/类
/**
* creates a proxy, delegating to a remote endpoint, forwarding to another remote endpoint, that delegates to an actual implementation.
* @param intf
* @param impl
* @return
* @throws IOException
*/
public <T> T wrap(Class<T> intf, T impl) {
PipedInputStream in1 = new PipedInputStream();
PipedOutputStream out1 = new PipedOutputStream();
Launcher<T> launcher1 = Launcher.createLauncher(impl, intf, in1, out1);
PipedInputStream in2 = new PipedInputStream();
PipedOutputStream out2 = new PipedOutputStream();
Launcher<T> launcher2 = Launcher.createLauncher(new Object(), intf, in2, out2);
try {
in1.connect(out2);
in2.connect(out1);
} catch (IOException e) {
throw new IllegalStateException(e);
}
launcher1.startListening();
launcher2.startListening();
return launcher2.getRemoteProxy();
}
示例6: redirectIn
import java.io.PipedInputStream; //导入方法依赖的package包/类
private static OutputStream redirectIn() throws IOException {
PipedInputStream pipedInputStream = new PipedInputStream();
System.setIn(pipedInputStream);
PipedOutputStream pipedOutputStream = new PipedOutputStream();
pipedInputStream.connect(pipedOutputStream);
return pipedOutputStream;
}
示例7: MicrophoneInputStream
import java.io.PipedInputStream; //导入方法依赖的package包/类
public MicrophoneInputStream() {
captureThread = new MicrophoneCaptureThread(this);
os = new PipedOutputStream();
is = new PipedInputStream();
try {
is.connect(os);
} catch (IOException e) {
Log.e(TAG, e.getMessage());
}
captureThread.start();
}
示例8: main
import java.io.PipedInputStream; //导入方法依赖的package包/类
public static void main(String[] args){
PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream();
try {
pis.connect(pos);
} catch (IOException e) {
e.printStackTrace();
}
new Thread(new ReadThread(pis)).start();
new Thread(new WriteThread(pos)).start();
}