本文整理汇总了Java中com.onegravity.rteditor.utils.io.output.StringBuilderWriter类的典型用法代码示例。如果您正苦于以下问题:Java StringBuilderWriter类的具体用法?Java StringBuilderWriter怎么用?Java StringBuilderWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringBuilderWriter类属于com.onegravity.rteditor.utils.io.output包,在下文中一共展示了StringBuilderWriter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import com.onegravity.rteditor.utils.io.output.StringBuilderWriter; //导入依赖的package包/类
/**
* Get the contents of an <code>InputStream</code> as a String
* using the specified character encoding.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
* </p>
*
* @param input the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested String
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since 2.3
*/
public static String toString(InputStream input, Charset encoding) throws IOException {
StringBuilderWriter sw = new StringBuilderWriter();
copy(input, sw, encoding);
return sw.toString();
}