write String to DataOutputStream - Java File Path IO

Java examples for File Path IO:DataOutputStream

Description

write String to DataOutputStream

Demo Code


//package com.java2s;

import java.io.DataOutputStream;
import java.io.IOException;

public class Main {
    public static void writeString(DataOutputStream out, String string)
            throws IOException {
        out.writeInt(string.length());/* ww w.j  av  a 2  s . co  m*/
        out.writeChars(string);
    }

    public static void writeInt(DataOutputStream out, int i)
            throws IOException {
        out.writeInt(i);
    }
}

Related Tutorials