Java examples for XML:XML String Output
write String to OutputStream
/************************************************************************** * Licensed Material - Property of Dawn InfoTek * * Copyright (c) Dawn InfoTek Inc. 1999, 2004, 2008 -All rights reserved. * * (<http://www.dawninfotek.com>) * * * * This file contains proprietary intellectual property of * * Dawn InfoTek Inc. The contents of and information in this file * * is only to be used in conjunction with a valid Dawn4J license * * as specified in the Dawn4J license agreement. All other use * * is prohibited. * **************************************************************************/ import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.util.Scanner; import org.apache.log4j.Logger; public class Main{ /**//w w w . j a v a2 s. c o m * * @param os * @param request * @param charsetName * @throws IOException */ public static final void writeString(OutputStream os, String request, String charsetName) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(os, charsetName); BufferedWriter bw = new BufferedWriter(writer); bw.write(request); bw.write("\r\n"); bw.flush(); } }