Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.ByteArrayOutputStream.toByteArray()


     * @throws IOException if an I/O error occurs
     */
    public static byte[] toByteArray(InputStream input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the default character encoding of the platform.
View Full Code Here


     * @throws IOException if an I/O error occurs
     */
    public static byte[] toByteArray(Reader input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the specified character encoding.
View Full Code Here

     */
    public static byte[] toByteArray(Reader input, String encoding)
            throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output, encoding);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>String</code> as a <code>byte[]</code>
     * using the default character encoding of the platform.
View Full Code Here

     * @throws IOException if an I/O error occurs
     */
    public static byte[] toByteArray(final InputStream input) throws IOException {
        final ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

    /**
     * Gets contents of an <code>InputStream</code> as a <code>byte[]</code>.
     * Use this method instead of <code>toByteArray(InputStream)</code>
View Full Code Here

     * @since 2.3
     */
    public static byte[] toByteArray(final Reader input, final Charset encoding) throws IOException {
        final ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output, encoding);
        return output.toByteArray();
    }

    /**
     * Gets the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the specified character encoding.
View Full Code Here

    setInfo.setOut(baos);
   
    // 将需要导出的数据输出到baos
    ExcelUtil.export2Excel(setInfo);
   
    return new ByteArrayInputStream(baos.toByteArray());
  }

  /**
   * @throws IllegalAccessException
   * @throws IOException
View Full Code Here

    setInfo.setOut(baos);
   
    // 将需要导出的数据输出到baos
    ExcelUtil.export2Excel(setInfo);
   
    return new ByteArrayInputStream(baos.toByteArray());
  }

  /**
   * @throws IllegalAccessException
   * @throws IOException
View Full Code Here

    setInfo.setOut(baos);
   
    // 将需要导出的数据输出到baos
    ExcelUtil.export2Excel(setInfo);
   
    return new ByteArrayInputStream(baos.toByteArray());
  }

  /**
   * @throws IllegalAccessException
   * @throws IOException
View Full Code Here

    setInfo.setOut(baos);
   
    // 将需要导出的数据输出到baos
    ExcelUtil.export2Excel(setInfo);
   
    return new ByteArrayInputStream(baos.toByteArray());
  }

  /**
   * @throws IllegalAccessException
   * @throws IOException
View Full Code Here

    setInfo.setOut(baos);
   
    // 将需要导出的数据输出到baos
    ExcelUtil.export2Excel(setInfo);
   
    return new ByteArrayInputStream(baos.toByteArray());
  }

  /**
   * @throws IllegalAccessException
   * @throws IOException
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.