本文整理了Java中org.apache.tika.io.IOUtils.write()
方法的一些代码示例,展示了IOUtils.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.write()
方法的具体详情如下:
包路径:org.apache.tika.io.IOUtils
类名称:IOUtils
方法名:write
[英]Writes chars from a CharSequence
to bytes on an OutputStream
using the default character encoding of the platform.
This method uses String#getBytes().
[中]使用平台的默认字符编码将字符从CharSequence
写入OutputStream
上的字节。
此方法使用字符串#getBytes()。
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>CharSequence</code> to a <code>Writer</code>.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, Writer output) throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the default character encoding of the
* platform.
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output)
throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
write(data.toString(), output, encoding);
}
}
代码示例来源:origin: apache/tika
/**
* Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code>
* using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(byte[], String)}.
*
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(new String(data, encoding));
}
}
}
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>String</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.getBytes(encoding));
}
}
}
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>char[]</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
*
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(new String(data).getBytes(encoding));
}
}
}
代码示例来源:origin: apache/tika
/**
* Writes chars from a <code>StringBuffer</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
* @deprecated replaced by write(CharSequence, OutputStream, String)
*/
@Deprecated
public static void write(StringBuffer data, OutputStream output,
String encoding) throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.toString().getBytes(encoding));
}
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>CharSequence</code> to a <code>Writer</code>.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, Writer output) throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes chars from a <code>CharSequence</code> to a <code>Writer</code>.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, Writer output) throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the default character encoding of the
* platform.
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output)
throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the default character encoding of the
* platform.
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output)
throws IOException {
if (data != null) {
write(data.toString(), output);
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
write(data.toString(), output, encoding);
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 2.0
*/
public static void write(CharSequence data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
write(data.toString(), output, encoding);
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code>
* using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(byte[], String)}.
*
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(new String(data, encoding));
}
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code>
* using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(byte[], String)}.
*
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(new String(data, encoding));
}
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>String</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.getBytes(encoding));
}
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes chars from a <code>String</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.getBytes(encoding));
}
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>char[]</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
*
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output, String encoding)
throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(new String(data).getBytes(encoding));
}
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Writes chars from a <code>StringBuffer</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
* @deprecated replaced by write(CharSequence, OutputStream, String)
*/
@Deprecated
public static void write(StringBuffer data, OutputStream output,
String encoding) throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.toString().getBytes(encoding));
}
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Writes chars from a <code>StringBuffer</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
* @deprecated replaced by write(CharSequence, OutputStream, String)
*/
@Deprecated
public static void write(StringBuffer data, OutputStream output,
String encoding) throws IOException {
if (data != null) {
if (encoding == null) {
write(data, output);
} else {
output.write(data.toString().getBytes(encoding));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!