Example usage for java.io OutputStream OutputStream

List of usage examples for java.io OutputStream OutputStream

Introduction

In this page you can find the example usage for java.io OutputStream OutputStream.

Prototype

OutputStream

Source Link

Usage

From source file:com.github.jessemull.microflexinteger.stat.GeometricMeanWeightsTest.java

/**
 * Generates random objects and numbers for testing.
 *///from w  w w.j  a v a  2  s  . c  o  m
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        Plate plate = RandomUtil.randomPlateInteger(rows, columns, minValue, maxValue, length, "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        Plate plateIndices = RandomUtil.randomPlateInteger(rows, columns, minValue, maxValue, lengthIndices,
                "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }

    for (int i = 0; i < weights.length; i++) {
        weights[i] = random.nextDouble();
    }

    for (int i = 0; i < weightsIndices.length; i++) {
        weightsIndices[i] = random.nextDouble();
    }
}

From source file:com.github.jessemull.microflexdouble.stat.GeometricMeanWeightsTest.java

/**
 * Generates random objects and numbers for testing.
 *///www.  ja  va  2  s .c  om
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        Plate plate = RandomUtil.randomPlateDouble(rows, columns, minValue, maxValue, length, "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        Plate plateIndices = RandomUtil.randomPlateDouble(rows, columns, minValue, maxValue, lengthIndices,
                "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }

    for (int i = 0; i < weights.length; i++) {
        weights[i] = random.nextDouble();
    }

    for (int i = 0; i < weightsIndices.length; i++) {
        weightsIndices[i] = random.nextDouble();
    }
}

From source file:com.github.jessemull.microflexbigdecimal.stat.GeometricMeanTest.java

/**
 * Generates random objects and numbers for testing.
 *//*from  ww  w. j  a va 2s  .co m*/
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        Plate plate = RandomUtil.randomPlateBigDecimal(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        Plate plateIndices = RandomUtil.randomPlateBigDecimal(rows, columns, minValue, maxValue, lengthIndices,
                "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }
}

From source file:com.github.jessemull.microflexbiginteger.stat.GeometricMeanTest.java

/**
 * Generates random objects and numbers for testing.
 *//* w ww.j  a va2s .  c o m*/
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        Plate plate = RandomUtil.randomPlateBigInteger(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        Plate plateIndices = RandomUtil.randomPlateBigInteger(rows, columns, minValue, maxValue, lengthIndices,
                "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }
}

From source file:com.github.jessemull.microflex.stat.statdouble.GeometricMeanDoubleWeightsTest.java

/**
 * Generates random objects and numbers for testing.
 *///from   w  w w  .  j  a v a 2 s .c o  m
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        PlateDouble plate = RandomUtil.randomPlateDouble(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        PlateDouble plateIndices = RandomUtil.randomPlateDouble(rows, columns, minValue, maxValue,
                lengthIndices, "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }

    for (int i = 0; i < weights.length; i++) {
        weights[i] = random.nextDouble();
    }

    for (int i = 0; i < weightsIndices.length; i++) {
        weightsIndices[i] = random.nextDouble();
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.GeometricMeanIntegerWeightsTest.java

/**
 * Generates random objects and numbers for testing.
 *///www . jav a2s .  c  om
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        PlateInteger plate = RandomUtil.randomPlateInteger(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        PlateInteger plateIndices = RandomUtil.randomPlateInteger(rows, columns, minValue, maxValue,
                lengthIndices, "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }

    for (int i = 0; i < weights.length; i++) {
        weights[i] = random.nextDouble();
    }

    for (int i = 0; i < weightsIndices.length; i++) {
        weightsIndices[i] = random.nextDouble();
    }
}

From source file:pxb.android.tinysign.TinySign.java

private static Manifest generateSF(Manifest manifest)
        throws NoSuchAlgorithmException, UnsupportedEncodingException {
    MessageDigest md = MessageDigest.getInstance("SHA1");
    PrintStream print = new PrintStream(new DigestOutputStream(new OutputStream() {

        @Override//from  w  w w  .  j  a va  2 s. co m
        public void write(byte[] arg0) throws IOException {
        }

        @Override
        public void write(byte[] arg0, int arg1, int arg2) throws IOException {
        }

        @Override
        public void write(int arg0) throws IOException {
        }
    }, md), true, "UTF-8");
    Manifest sf = new Manifest();
    Map<String, Attributes> entries = manifest.getEntries();
    for (Map.Entry<String, Attributes> entry : entries.entrySet()) {
        // Digest of the manifest stanza for this entry.
        print.print("Name: " + entry.getKey() + "\r\n");
        for (Map.Entry<Object, Object> att : entry.getValue().entrySet()) {
            print.print(att.getKey() + ": " + att.getValue() + "\r\n");
        }
        print.print("\r\n");
        print.flush();

        Attributes sfAttr = new Attributes();
        sfAttr.putValue("SHA1-Digest", eBase64(md.digest()));
        sf.getEntries().put(entry.getKey(), sfAttr);
    }
    return sf;
}

From source file:com.github.jessemull.microflex.stat.statbigdecimal.GeometricMeanBigDecimalTest.java

/**
 * Generates random objects and numbers for testing.
 *///from www .j  ava2 s .  c  om
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        PlateBigDecimal plate = RandomUtil.randomPlateBigDecimal(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        PlateBigDecimal plateIndices = RandomUtil.randomPlateBigDecimal(rows, columns, minValue, maxValue,
                lengthIndices, "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }
}

From source file:com.github.jessemull.microflex.stat.statbiginteger.GeometricMeanBigIntegerTest.java

/**
 * Generates random objects and numbers for testing.
 *///from  www  . j a v  a2  s.  c o  m
@BeforeClass
public static void setUp() {

    if (error) {

        System.setErr(new PrintStream(new OutputStream() {
            public void write(int x) {
            }
        }));

    }

    for (int j = 0; j < array.length; j++) {

        PlateBigInteger plate = RandomUtil.randomPlateBigInteger(rows, columns, minValue, maxValue, length,
                "Plate1-" + j);

        array[j] = plate;
    }

    for (int j = 0; j < arrayIndices.length; j++) {

        PlateBigInteger plateIndices = RandomUtil.randomPlateBigInteger(rows, columns, minValue, maxValue,
                lengthIndices, "Plate1-" + j);

        arrayIndices[j] = plateIndices;
    }
}

From source file:org.opennms.web.controller.admin.support.FormatterView.java

@Override
public void render(final Map<String, ?> model, final HttpServletRequest request,
        final HttpServletResponse response) throws Exception {
    if (m_view == null) {
        String fileName = getFileName(request);
        response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
    } else {//from   w  ww.  j  a  va  2  s . com
        final String outputParameter = request.getParameter("output");
        m_formatter.setOutput(outputParameter);
    }
    if (model.containsKey("report")) {
        final SystemReportInfo info = (SystemReportInfo) model.get("report");
        LOG.debug("found report = {}", info);
        final OutputStream output;

        if (m_view == null) {
            output = response.getOutputStream();
        } else {
            output = new OutputStream() {
                @Override
                public void write(int b) throws IOException {
                }
            };
        }

        try {
            LOG.debug("beginning output");
            m_formatter.setOutputStream(output);
            m_formatter.begin();

            for (final SystemReportPlugin plugin : info.getPlugins()) {
                LOG.debug("running plugin {}", plugin);
                m_formatter.write(plugin);
                output.flush();
            }

            LOG.debug("finishing output");
            m_formatter.end();
        } catch (final Throwable e) {
            LOG.warn("Error while formatting system report output", e);
            throw new SystemReportException(e);
        } finally {
            IOUtils.closeQuietly(output);
        }
    } else {
        LOG.info("Invalid form input: {}", model);
        throw new SystemReportException("Form input was invalid.");
    }
    LOG.debug("done");
    if (m_view != null) {
        m_view.render(model, request, response);
    }
}