Code example for ByteArrayOutputStream

Methods: toString

			CommunicationException { 
		final String pubsubServiceJid = pubsubService.getJid();
		final String itemXml;
		try {			 
			ByteArrayOutputStream os = new ByteArrayOutputStream();
			serializer.write(item, os);
			itemXml = os.toString();
		} catch (TransformerException e) {
			throw new CommunicationException(e.getMessage(), e);
		} catch (ParserConfigurationException e) {
			throw new CommunicationException("ParserConfigurationException while marshalling item to publish", e);
		} catch (Exception e) {
			throw new CommunicationException("Exception while marshalling item to publish", e);
		return (String)invokeRemoteMethod(new IMethodInvocation<Pubsub>() {
			public Object invoke(Pubsub pubsub) throws Throwable {
				return pubsub.publisherPublish(pubsubServiceJid, node, itemId, itemXml);
Connect your IDE to all the code out there  Get Codota for Java