at.spardat.xma.rpc.RemoteCallServer Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
// @(#) $Id: RemoteCallServer.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.rpc;
import java.io.IOException;
import at.spardat.xma.serializer.Deserializer;
import at.spardat.xma.serializer.SerializerFactory;
import at.spardat.xma.serializer.SerializerFactoryServer;
import at.spardat.xma.util.ByteArray;
/**
* Abstraction for a RemoteCall at the server.
*
* @author YSD, 03.08.2003 00:31:47
*/
public class RemoteCallServer extends RemoteCall {
/**
* Used by the server to create an object of this class at the server side.
*
* @param inputStream the byte stream transmitted from the client
* @param offset where to start reading in inputStream.
* @param length how many bytes to read
*/
RemoteCallServer (byte [] inputStream, int offset, int length) throws IOException, ClassNotFoundException {
SerializerFactory fac = new SerializerFactoryServer();
Deserializer deser = fac.createDeserializer(null, inputStream, offset, length);
data_ = new RemoteCallData();
data_.internalize (deser);
}
/**
* Constructs and takes the data from byteArr. The ByteArray
* must have set a header.
*/
RemoteCallServer (ByteArray byteArr) throws IOException, ClassNotFoundException {
this (byteArr.getBuffer(), ByteArray.HEADER_LEN, byteArr.size()-ByteArray.HEADER_LEN);
if (!byteArr.hasHeader()) throw new IllegalArgumentException();
}
}