Java Utililty Methods OutputStream Write String

List of utility methods to do OutputStream Write String

  1. HOME
  2. Java
  3. O
  4. OutputStream Write String

Description

The list of methods to do OutputStream Write String are organized into topic(s).

Method

void writeString(ByteArrayOutputStream baos, String s)
write String
try {
 writeData(baos, s.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
 throw new RuntimeException("Cannot write string", e);
void writeString(final OutputStream output, final String s)
write String
final int length = s.length();
int strIdx = 0;
while (strIdx < length) {
 writeChar(output, s.charAt(strIdx++));
void writeString(ObjectOutputStream stream, String string)
Writes a String to an ObjectOutputStream
stream.writeShort((short) string.length());
for (int i = 0; i < string.length(); i++) {
 stream.writeChar(string.charAt(i));
void writeString(OutputStream os, String request, String charsetName)
write String
OutputStreamWriter writer = new OutputStreamWriter(os, charsetName);
BufferedWriter bw = new BufferedWriter(writer);
bw.write(request);
bw.write("\r\n");
bw.flush();
void writeString(OutputStream os, String s)
write String
byte[] b = s.getBytes("UTF-8");
writeLong(os, b.length);
os.write(b, 0, b.length);
void writeString(OutputStream os, String s)
write String
int n = s.length();
for (int i = 0; i < n; i++) {
 char c = s.charAt(i);
 if (c < 0x80) {
 os.write(c);
 } else if (c < 0x800) {
 os.write(0xc0 + (c >> 6));
 os.write(0x80 + (c & 0x3f));
...
void writeString(OutputStream os, String s)
write String
byte[] b = s.getBytes("UTF-8");
writeLong(os, b.length);
os.write(b, 0, b.length);
void writeString(OutputStream os, String str)
Writes a string to the specified output stream.
for (char c : str.toCharArray()) {
 os.write(c);
os.write('0円');
void writeString(OutputStream os, String text)
write String
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(text);
writer.flush();
writer.close();
void writeString(OutputStream out, String s)
write String
byte[] buf = s.getBytes("UTF8");
short len = (short) buf.length;
out.write((len >> 8) & 0xFF);
out.write(len & 0xFF);
out.write(buf);


AltStyle によって変換されたページ (->オリジナル) /