当前位置: 首页>>代码示例>>Java>>正文


Java PipedInputStream.connect方法代码示例

本文整理汇总了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);
}
 
开发者ID:rizsi,项目名称:rcom,代码行数:23,代码来源:SpeexEchoCancel.java

示例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);
}
 
开发者ID:rizsi,项目名称:rcom,代码行数:23,代码来源:SpeexEchoCancel.java

示例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();
}
 
开发者ID:watson-developer-cloud,项目名称:android-sdk,代码行数:22,代码来源:MicrophoneInputStream.java

示例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();
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:17,代码来源:LauncherTest.java

示例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();
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:26,代码来源:ProtocolTest.java

示例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;
}
 
开发者ID:Azzurite,项目名称:MinecraftServerSync,代码行数:10,代码来源:LocalConsole.java

示例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();
}
 
开发者ID:blumareks,项目名称:2016EduHackathon_SanFrancisco,代码行数:12,代码来源:MicrophoneInputStream.java

示例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();
}
 
开发者ID:StrongAndroid,项目名称:JavaNote,代码行数:14,代码来源:PipeStream.java


注:本文中的java.io.PipedInputStream.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。