Here you can find the source of writeStringAsBytes(DataOutputStream out, byte[] byteArray)
Parameter | Description |
---|---|
out | a parameter |
byteArray | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static final void writeStringAsBytes(DataOutputStream out, byte[] byteArray) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2016 Rogue Wave Software, Inc. * 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://from w ww . ja va 2s . c o m * Rogue Wave Software, Inc. - initial API and implementation *******************************************************************************/ import java.io.DataOutputStream; import java.io.IOException; public class Main { /** * Writes string as bytes to data output stream. * * @param out * @param byteArray * @throws IOException */ public static final void writeStringAsBytes(DataOutputStream out, byte[] byteArray) throws IOException { out.writeInt(byteArray.length); out.write(byteArray); } }