Code example for ByteArrayOutputStream

Methods: toString

0
		// TODO errorhandling 
		Document out=null;
		Header content_type=method.getResponseHeader("Content-Type");
		if(content_type!=null && "application/xml".equals(content_type.getValue())) {
			if(log.isDebugEnabled()) {
				ByteArrayOutputStream dump = new ByteArrayOutputStream();
				// TODO CSPACE-2552 add ,"UTF-8" to reader.read()? 
				out=reader.read(new TeeInputStream(stream,dump));
				log.debug(dump.toString("UTF-8"));
			} else { 
				// TODO CSPACE-2552 add ,"UTF-8" to reader.read()? 
				out=reader.read(stream); 
			} 
		} 
		stream.close();
		doc=out;
	} 
}