Java DataOutputStream Write String writeString(DataOutputStream out, String s)

Here you can find the source of writeString(DataOutputStream out, String s)

Description

write String

License

Open Source License

Declaration

public static final void writeString(DataOutputStream out, String s) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

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

public class Main {
    public static final void writeString(DataOutputStream out, String s) throws IOException {
        boolean isNull = s == null;

        out.writeBoolean(isNull);/*from w  ww .j a  va2s . com*/

        if (!isNull) {
            out.writeUTF(s);
        }
    }
}

Related

  1. writeString(DataOutputStream buf, String value)
  2. writeString(DataOutputStream os, String s)
  3. writeString(DataOutputStream os, String str)
  4. writeString(DataOutputStream out, String str)
  5. writeString(DataOutputStream out, String str)
  6. writeString(DataOutputStream out, String str)
  7. writeString(DataOutputStream out, String text)