Here you can find the source of writeString(OutputStream output, String string)
public static void writeString(OutputStream output, String string) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Freescale Semiconductor. * 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 * /*from ww w .ja v a 2 s .c o m*/ * Contributors: * Serge Beauchamp (Freescale Semiconductor) - initial API and implementation *******************************************************************************/ import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeString(OutputStream output, String string) throws IOException { // if changed, don't forget to update calculateStringOutput() output.write(("<" + Integer.toString(string.length()) + ">").getBytes()); output.write(("<" + string + ">").getBytes()); } }