summaryrefslogtreecommitdiff
path: root/docs/jacoco-ut/bjc.everge/MirrorOutputStream.java.html
blob: 51175e0705fde68f203dbc76d1f62665fb0dc207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MirrorOutputStream.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">everge</a> &gt; <a href="index.source.html" class="el_package">bjc.everge</a> &gt; <span class="el_source">MirrorOutputStream.java</span></div><h1>MirrorOutputStream.java</h1><pre class="source lang-java linenums">package bjc.everge;

import java.io.*;
import java.util.*;

/**
 * An output stream that mirrors its contents to other streams.
 * 
 * @author Ben Culkin
 *
 */
public class MirrorOutputStream extends OutputStream {
	private List&lt;OutputStream&gt; streams;

	/**
	 * Create a new mirroring output stream.
	 * 
	 * @param strams
	 *               The output streams to mirror to.
	 */
<span class="fc" id="L21">	public MirrorOutputStream(OutputStream... strams) {</span>
<span class="fc" id="L22">		streams = new ArrayList&lt;&gt;();</span>

<span class="fc bfc" id="L24" title="All 2 branches covered.">		for (OutputStream stram : strams) {</span>
<span class="fc" id="L25">			streams.add(stram);</span>
		}
<span class="fc" id="L27">	}</span>

	@Override
	public void close() throws IOException {
<span class="nc bnc" id="L31" title="All 2 branches missed.">		for (OutputStream stream : streams) {</span>
<span class="nc" id="L32">			stream.close();</span>
<span class="nc" id="L33">		}</span>
<span class="nc" id="L34">	}</span>

	@Override
	public void flush() throws IOException {
<span class="nc bnc" id="L38" title="All 2 branches missed.">		for (OutputStream stream : streams) {</span>
<span class="nc" id="L39">			stream.flush();</span>
<span class="nc" id="L40">		}</span>
<span class="nc" id="L41">	}</span>

	@Override
	public void write(byte[] ba) throws IOException {
<span class="nc bnc" id="L45" title="All 2 branches missed.">		for (OutputStream stream : streams) {</span>
<span class="nc" id="L46">			stream.write(ba);</span>
<span class="nc" id="L47">		}</span>
<span class="nc" id="L48">	}</span>

	@Override
	public void write(byte[] ba, int off, int len) throws IOException {
<span class="fc bfc" id="L52" title="All 2 branches covered.">		for (OutputStream stream : streams) {</span>
<span class="fc" id="L53">			stream.write(ba, off, len);</span>
<span class="fc" id="L54">		}</span>
<span class="fc" id="L55">	}</span>

	@Override
	public void write(int b) throws IOException {
<span class="nc bnc" id="L59" title="All 2 branches missed.">		for (OutputStream stream : streams) {</span>
<span class="nc" id="L60">			stream.write(b);</span>
<span class="nc" id="L61">		}</span>
<span class="nc" id="L62">	}</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.2.201808211720</span></div></body></html>