Java DataOutputStream Write String writeStringAsBytes(DataOutputStream out, byte[] byteArray)

Here you can find the source of writeStringAsBytes(DataOutputStream out, byte[] byteArray)

Description

write String As Bytes

License

Open Source License

Declaration

public static void writeStringAsBytes(DataOutputStream out,
            byte[] byteArray) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2007 IBM Corporation 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
 *
 * Contributors://  ww w.j a  v a2 s. c om
 *   Zend and IBM - Initial implementation
 *******************************************************************************/

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

public class Main {
    public static void writeStringAsBytes(DataOutputStream out,
            byte[] byteArray) throws IOException {
        out.writeInt(byteArray.length);
        out.write(byteArray);
    }
}

Related

  1. writeString(String s, DataOutputStream out)
  2. writeString(String s, DataOutputStream writer)
  3. writeString(String str, DataOutputStream dos)
  4. writeString(String str, DataOutputStream os)
  5. writeString(String stringToWrite, DataOutputStream data)
  6. writeStringAsBytes(DataOutputStream out, byte[] byteArray)
  7. writeStringList(List list, DataOutputStream os)
  8. writeStringOrNull(DataOutputStream out, String string)