ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Starsscream Desepticon <kastanienr...@yahoo.co.uk>
Subject Re: How do you convert a base64 object to original object?
Date Fri, 04 Nov 2005 13:46:09 GMT
Hi

Posted this code in a previous mail:

public static Object getObject(byte[] array) {
	try {
		ByteArrayInputStream bais = new ByteArrayInputStream(array);
		ObjectInputStream ois = new ObjectInputStream(bais);
		return ois.readObject();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}


--- rjoshi@dataarmor.net wrote:

> Hi,
> 
> Just curious... how is that helping you to cast the byte array back to 
> the object thats implementing SecretKey?
> 
> will simple typecasting work in this case, to get back ur custom object??
> 
> Starsscream Desepticon wrote:
> 
> >Thanks for the help. I made some silly mistake.
> >
> >
> >In case you're still interested Elvio:
> >
> >byte[] response = (byte[]) xmlrpc.execute("handler.test", parameters);
> >
> >To transform between object/byte array see earlier post. As John said Apache does
the Base64
> >encoding.
> >
> >Rudi
> >
> >
> >
> >--- John Wilson <tug@wilson.co.uk> wrote:
> >
> >  
> >
> >>On 4 Nov 2005, at 11:41, Starsscream Desepticon wrote:
> >>
> >>    
> >>
> >>>Thanks!
> >>>
> >>>But I still have the problem, that execute() returns  
> >>>java.lang.Object. I cannot cast the response
> >>>(Object) to the original object, because it is a byte array. So how  
> >>>can I get my original object?
> >>>      
> >>>
> >>You say you get an exception when you cast the result to byte[]?
> >>
> >>can you put this in your code and post the output?
> >>
> >>System.out.println(o.getClass().getName());
> >>
> >>Then cast o to byte[] and post the stack trace
> >>
> >>
> >>John Wilson
> >>The Wilson Partnership
> >>http://www.wilson.co.uk
> >>
> >>
> >>
> >>    
> >>
> >
> >
> >
> >		
> >___________________________________________________________ 
> >To help you stay safe and secure online, we've developed the all new Yahoo! Security
Centre.
> http://uk.security.yahoo.com
> >
> >  
> >
> 
> -- 
> Thanks,
> 
> Rahul Joshi
> 
> 
> 
> _________ 'Don't Even Think About Clicking Here' __________ 
> <http://www.mindistortion.net/iwantyoursoul/?i_am=curse%20of%20samara>
> 



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

Mime
View raw message