SerializableParser.java
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one
00003  * or more contributor license agreements.  See the NOTICE file
00004  * distributed with this work for additional information
00005  * regarding copyright ownership.  The ASF licenses this file
00006  * to you under the Apache License, Version 2.0 (the
00007  * "License"); you may not use this file except in compliance
00008  * with the License.  You may obtain a copy of the License at
00009  *
00010  *   http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing,
00013  * software distributed under the License is distributed on an
00014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015  * KIND, either express or implied.  See the License for the
00016  * specific language governing permissions and limitations
00017  * under the License.    
00018  */
00019 package org.apache.xmlrpc.parser;
00020 
00021 import java.io.ByteArrayInputStream;
00022 import java.io.IOException;
00023 import java.io.ObjectInputStream;
00024 
00025 import org.apache.xmlrpc.XmlRpcException;
00026 
00027 
00030 public class SerializableParser extends ByteArrayParser {
00031         public Object getResult() throws XmlRpcException {
00032                 try {
00033                         byte[] res = (byte[]) super.getResult();
00034                         ByteArrayInputStream bais = new ByteArrayInputStream(res);
00035                         ObjectInputStream ois = new ObjectInputStream(bais);
00036                         return ois.readObject();
00037                 } catch (IOException e) {
00038                         throw new XmlRpcException("Failed to read result object: " + e.getMessage(), e);
00039                 } catch (ClassNotFoundException e) {
00040                         throw new XmlRpcException("Failed to load class for result object: " + e.getMessage(), e);
00041                 }
00042         }
00043 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49