Java Code Examples for java.io.PipedInputStream

The following examples show how to use java.io.PipedInputStream. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: PacketProxy   Source File: DuplexAsync.java    License: Apache License 2.0 6 votes vote down vote up
public DuplexAsync(Endpoint client_endpoint, Endpoint server_endpoint) throws Exception
{
	this.client = client_endpoint;
	this.server = server_endpoint;
	client_input  = (client_endpoint != null) ? client_endpoint.getInputStream() : null;
	client_output = (client_endpoint != null) ? client_endpoint.getOutputStream() : null;
	server_input  = (server_endpoint != null) ? server_endpoint.getInputStream() : null;
	server_output = (server_endpoint != null) ? server_endpoint.getOutputStream() : null;
	
	flow_controlled_client_output = new PipedOutputStream();
	flow_controlled_client_input = new PipedInputStream(flow_controlled_client_output, 65536);

	flow_controlled_server_output = new PipedOutputStream();
	flow_controlled_server_input = new PipedInputStream(flow_controlled_server_output, 65536);

	client_to_server = createClientToServerSimplex(client_input, flow_controlled_server_output);
	server_to_client = createServerToClientSimplex(server_input, flow_controlled_client_output);
	
	disableDuplexEventListener();
}
 
Example 2
Source Project: datacollector   Source File: SupportBundleManager.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Return InputStream from which a new generated resource bundle can be retrieved.
 */
public SupportBundle generateNewBundle(List<String> generatorNames, BundleType bundleType) throws IOException {
  List<BundleContentGeneratorDefinition> defs = getRequestedDefinitions(generatorNames);

  PipedInputStream inputStream = new PipedInputStream();
  PipedOutputStream outputStream = new PipedOutputStream();
  inputStream.connect(outputStream);
  ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);

  executor.submit(() -> generateNewBundleInternal(defs, bundleType, zipOutputStream));

  String bundleName = generateBundleName(bundleType);
  String bundleKey = generateBundleDate(bundleType) + "/" + bundleName;

  return new SupportBundle(
    bundleKey,
    bundleName,
    inputStream
  );
}
 
Example 3
Source Project: cachecloud   Source File: ProtocolTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void buildACommand() throws IOException {
  PipedInputStream pis = new PipedInputStream();
  BufferedInputStream bis = new BufferedInputStream(pis);
  PipedOutputStream pos = new PipedOutputStream(pis);
  RedisOutputStream ros = new RedisOutputStream(pos);

  Protocol.sendCommand(ros, Protocol.Command.GET, "SOMEKEY".getBytes(Protocol.CHARSET));
  ros.flush();
  pos.close();
  String expectedCommand = "*2\r\n$3\r\nGET\r\n$7\r\nSOMEKEY\r\n";

  int b;
  StringBuilder sb = new StringBuilder();
  while ((b = bis.read()) != -1) {
    sb.append((char) b);
  }

  assertEquals(expectedCommand, sb.toString());
}
 
Example 4
Source Project: jdk8u-jdk   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 5
Source Project: hop   Source File: S3CommonPipedOutputStream.java    License: Apache License 2.0 6 votes vote down vote up
public S3CommonPipedOutputStream( S3CommonFileSystem fileSystem, String bucketId, String key, int partSize ) throws IOException {
  this.pipedInputStream = new PipedInputStream();

  try {
    this.pipedInputStream.connect( this );
  } catch ( IOException e ) {
    // FATAL, unexpected
    throw new IOException( "could not connect to pipedInputStream", e );
  }

  this.s3AsyncTransferRunner = new S3AsyncTransferRunner();
  this.bucketId = bucketId;
  this.key = key;
  this.fileSystem = fileSystem;
  this.partSize = partSize;
}
 
Example 6
Source Project: dragonwell8_jdk   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 7
Source Project: jdk8u_jdk   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarList(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-tvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 8
Source Project: java-samples   Source File: MvsConsoleWrapper.java    License: Apache License 2.0 6 votes vote down vote up
static void redirectSystemOut() throws Exception {
	PipedOutputStream pos = new PipedOutputStream();
	PrintStream ps = new PrintStream(pos);
	PipedInputStream pis = new PipedInputStream(pos);
	final BufferedReader reader = new BufferedReader(new InputStreamReader(pis));

	new Thread() {
		public void run() {
			try {
				String line = null;
				while ((line = reader.readLine()) != null) {
					MvsConsole.wto(line, 
									MvsConsole.ROUTCDE_SYSPROG_INFORMATION,
									MvsConsole.DESC_JOB_STATUS);
				}
			} catch(IOException ioe) {
				// Pipe breaks when shutting down; ignore
			}
		}
	}.start();
	System.setOut(ps);
}
 
Example 9
Source Project: jdk8u60   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 10
Source Project: headlong   Source File: RLPStreamTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testUnrecoverable() throws Throwable {
    try (PipedOutputStream pos = new PipedOutputStream();
         PipedInputStream pis = new PipedInputStream(pos, 512);
         RLPStream stream = new RLPStream(pis)) {
        pos.write(0x81);
        pos.write(0x00);
        Iterator<RLPItem> iter = stream.iterator();
        TestUtils.assertThrown(IllegalArgumentException.class, "invalid rlp for single byte @ 0", iter::hasNext);
        try (RLPStream stream2 = new RLPStream(pis)) {
            pos.write(0xf8);
            pos.write(0x37);
            Iterator<RLPItem> iter2 = stream2.iterator();
            for (int i = 0; i < 3; i++) {
                TestUtils.assertThrown(
                        IllegalArgumentException.class,
                        "long element data length must be 56 or greater; found: 55 for element @ 0",
                        iter2::hasNext
                );
            }
        }
    }
}
 
Example 11
Source Project: Ardulink-2   Source File: StreamReaderTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void canHandleDataNotAlreadyPresentSeparatedByNewline()
		throws Exception {
	List<String> expected = Arrays.asList("a", "b", "c");

	PipedOutputStream os = new PipedOutputStream();
	PipedInputStream is = new PipedInputStream(os);

	StreamReader reader = process(is, "\n", expected);

	TimeUnit.SECONDS.sleep(2);
	os.write("a\nb\nc\n".getBytes());

	waitUntil(expected.size());
	assertThat(received, is(expected));
	reader.close();
}
 
Example 12
Source Project: aesh-readline   Source File: LineDisciplineTerminal.java    License: Apache License 2.0 6 votes vote down vote up
public LineDisciplineTerminal(String name,
                              String type,
                              OutputStream masterOutput) throws IOException {
    super(name, type);
    PipedInputStream input = new LinePipedInputStream(PIPE_SIZE);
    this.slaveInputPipe = new PipedOutputStream(input);
    // This is a hack to fix a problem in gogo where closure closes
    // streams for commands if they are instances of PipedInputStream.
    // So we need to get around and make sure it's not an instance of
    // that class by using a dumb FilterInputStream class to wrap it.
    this.slaveInput = new FilterInputStream(input) {};
    this.slaveOutput = new FilteringOutputStream();
    this.masterOutput = masterOutput;
    this.attributes = new Attributes();
    this.size = new Size(160, 50);
}
 
Example 13
Source Project: activiti6-boot2   Source File: BarURLHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public InputStream getInputStream() throws IOException {
  final PipedInputStream pin = new PipedInputStream();
  final PipedOutputStream pout = new PipedOutputStream(pin);
  new Thread() {
    public void run() {
      try {
        BarTransformer.transform(barXmlURL, pout);
      } catch (Exception e) {
        LOGGER.warn("Bundle cannot be generated");
      } finally {
        try {
          pout.close();
        } catch (IOException ignore) {
          // if we get here something is very wrong
          LOGGER.error("Bundle cannot be generated", ignore);
        }
      }
    }
  }.start();
  return pin;
}
 
Example 14
Source Project: openjdk-jdk8u   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 15
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 16
Source Project: android-sdk   Source File: MicrophoneInputStream.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 17
Source Project: jdk8u-jdk   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 18
Source Project: openjdk-8   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 19
Source Project: openjdk-jdk9   Source File: JarBackSlash.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void testJarList(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-tvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);

    String jarArgs[] = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);

    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);

    int rc = JAR_TOOL.run(out, System.err, jarArgs);
    if (rc != 0) {
        fail("Could not list jar file.");
    }

    out.flush();
    check(pipedInput.available() > 0);
}
 
Example 20
Source Project: stratosphere   Source File: RecordTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{
	PipedInputStream pipedInput = new PipedInputStream(1024*1024);
	this.in = new DataInputStream(pipedInput);
	this.out = new DataOutputStream(new PipedOutputStream(pipedInput));
}
 
Example 21
Source Project: docker-plugin   Source File: DockerMultiplexedInputStreamTest.java    License: MIT License 5 votes vote down vote up
public DemuxTester() throws IOException {
    feeder = new PipedOutputStream();

    feeder_input_stream = new PipedInputStream();
    feeder_input_stream.connect(feeder);
    
    stream = new DockerMultiplexedInputStream(feeder_input_stream);
    sink = new ByteArrayOutputStream();
    eof = false;
    exc = null;

    thread = new Thread(this);
    thread.start();
}
 
Example 22
Source Project: Flink-CEPplus   Source File: PrimitiveDataTypeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	in = new PipedInputStream(1000);
	out = new PipedOutputStream(in);
	mIn = new DataInputViewStreamWrapper(in);
	mOut = new DataOutputViewStreamWrapper(out);
}
 
Example 23
Source Project: aesh-readline   Source File: AbstractWindowsTerminal.java    License: Apache License 2.0 5 votes vote down vote up
public AbstractWindowsTerminal(boolean consumeCP, OutputStream output, String name, boolean nativeSignals, SignalHandler signalHandler) throws IOException {
    super(name, "windows", signalHandler);
    PipedInputStream input = new PipedInputStream(PIPE_SIZE);
    this.slaveInputPipe = new PipedOutputStream(input);
    this.input = new FilterInputStream(input) {};
    this.cpConsumer = consumeCP ? new ConsoleOutput() : null;
    this.output = output;
    String encoding = getConsoleEncoding();
    if (encoding == null) {
        encoding = Charset.defaultCharset().name();
    }
    this.writer = new PrintWriter(new OutputStreamWriter(this.output, encoding));
    // Attributes
    attributes.setLocalFlag(Attributes.LocalFlag.ISIG, true);
    attributes.setControlChar(Attributes.ControlChar.VINTR, ctrl('C'));
    attributes.setControlChar(Attributes.ControlChar.VEOF,  ctrl('D'));
    attributes.setControlChar(Attributes.ControlChar.VSUSP, ctrl('Z'));
    // Handle signals
    if (nativeSignals) {
        for (final Signal signal : Signal.values()) {
            nativeHandlers.put(signal,
                    Signals.register(signal.name(), () -> raise(signal)));
        }
    }
    pump = new Thread(this::pump, "WindowsStreamPump");
    pump.setDaemon(true);
    pump.start();
    closer = this::close;
    ShutdownHooks.add(closer);
}
 
Example 24
Source Project: flink   Source File: PrimitiveDataTypeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	in = new PipedInputStream(1000);
	out = new PipedOutputStream(in);
	mIn = new DataInputViewStreamWrapper(in);
	mOut = new DataOutputViewStreamWrapper(out);
}
 
Example 25
Source Project: KeePassJava2   Source File: XmlOutputStreamFilter.java    License: Apache License 2.0 5 votes vote down vote up
public XmlOutputStreamFilter(final OutputStream outputStream, final XmlEventTransformer eventTransformer) throws IOException {

        super();
        pipedInputStream = new PipedInputStream(this);

        Callable<Boolean> output = new Callable<Boolean>() {
            public Boolean call() {
                try {
                    XMLEventReader eventReader = new com.fasterxml.aalto.stax.InputFactoryImpl()
                            .createXMLEventReader(pipedInputStream);
                    XMLEventWriter eventWriter = new com.fasterxml.aalto.stax.OutputFactoryImpl()
                            .createXMLEventWriter(outputStream);

                    XMLEvent event = null;
                    while (eventReader.hasNext()) {
                        event = eventReader.nextEvent();
                        event = eventTransformer.transform(event);
                        eventWriter.add(event);
                        eventWriter.flush();
                    }

                    eventReader.close();
                    eventWriter.flush();
                    eventWriter.close();
                    outputStream.flush();
                    outputStream.close();
                } catch (XMLStreamException | IOException e) {
                    throw new IllegalStateException(e);
                }
                return true;
            }
        };
        future = Executors.newSingleThreadExecutor().submit(output);
    }
 
Example 26
Source Project: whiskey   Source File: HttpUrlConnectionImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public OutputStream getOutputStream() throws IOException {

    PipedOutputStream out = new PipedOutputStream();
    PipedInputStream in = new PipedInputStream();
    in.connect(out);
    requestBuilder.body(in);
    return out;
}
 
Example 27
Source Project: bither-desktop-java   Source File: UEntropyCollector.java    License: Apache License 2.0 5 votes vote down vote up
public void start() throws IOException {
    if (shouldCollectData) {
        return;
    }
    shouldCollectData = true;
    in = new PipedInputStream(POOL_SIZE);
    out = new PipedOutputStream(in);
}
 
Example 28
Source Project: Javacord   Source File: FileContainer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the input stream for the file.
 *
 * @param api The discord api instance.
 * @return The input stream for the file.
 * @throws IOException If an IO error occurs.
 */
public InputStream asInputStream(DiscordApi api) throws IOException {
    if (fileAsBufferedImage != null) {
        PipedOutputStream pos = new PipedOutputStream();
        PipedInputStream pis = new PipedInputStream(pos);
        api.getThreadPool().getExecutorService().submit(() -> {
            try {
                ImageIO.write(fileAsBufferedImage, getFileType(), pos);
                pos.close();
            } catch (Throwable t) {
                logger.error("Failed to process buffered image file!", t);
            }
        });
        return pis;
    }
    if (fileAsFile != null) {
        return new FileInputStream(fileAsFile);
    }
    if (fileAsIcon != null || fileAsUrl != null) {
        URL url = fileAsUrl == null ? fileAsIcon.getUrl() : fileAsUrl;
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
        conn.setRequestProperty("User-Agent", Javacord.USER_AGENT);
        return conn.getInputStream();
    }
    if (fileAsByteArray != null) {
        return new ByteArrayInputStream(fileAsByteArray);
    }
    if (fileAsInputStream != null) {
        return fileAsInputStream;
    }
    throw new IllegalStateException("No file variant is set");
}
 
Example 29
private static InputStream getInputStream(final AwContentsClient contentClient)
        throws IOException {
    final PipedInputStream inputStream = new PipedInputStream();
    final PipedOutputStream outputStream = new PipedOutputStream(inputStream);

    // Send the request to UI thread to callback to the client, and if it provides a
    // valid bitmap bounce on to the worker thread pool to compress it into the piped
    // input/output stream.
    ThreadUtils.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final Bitmap defaultVideoPoster = contentClient.getDefaultVideoPoster();
            if (defaultVideoPoster == null) {
                closeOutputStream(outputStream);
                return;
            }
            AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        defaultVideoPoster.compress(Bitmap.CompressFormat.PNG, 100,
                                outputStream);
                        outputStream.flush();
                    } catch (IOException e) {
                        Log.e(TAG, null, e);
                    } finally {
                        closeOutputStream(outputStream);
                    }
                }
            });
        }
    });
    return inputStream;
}
 
Example 30
Source Project: libstreaming   Source File: RtcpDeinterleaver.java    License: Apache License 2.0 5 votes vote down vote up
public RtcpDeinterleaver(InputStream inputStream) {
	mInputStream = inputStream;
	mPipedInputStream = new PipedInputStream(4096);
	try {
		mPipedOutputStream = new PipedOutputStream(mPipedInputStream);
	} catch (IOException e) {}
	mBuffer = new byte[1024];
	new Thread(this).start();
}