blob: 578359b9b0b6975f817369dac491e76434b5e213 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package io.v.impl.google.rpc;
import io.v.v23.naming.Endpoint;
import io.v.v23.rpc.Server;
import io.v.v23.rpc.ServerCall;
import io.v.v23.rpc.Stream;
import io.v.v23.rpc.StreamServerCall;
import io.v.v23.security.Blessings;
import io.v.v23.security.Call;
import io.v.v23.verror.VException;
import java.io.EOFException;
import java.lang.reflect.Type;
public class StreamServerCallImpl implements StreamServerCall {
private final long nativePtr;
private final Stream stream;
private final ServerCall serverCall;
private native void nativeFinalize(long nativePtr);
private StreamServerCallImpl(long nativePtr, Stream stream, ServerCall serverCall) {
this.nativePtr = nativePtr;
this.stream = stream;
this.serverCall = serverCall;
}
// Implements io.v.v23.rpc.Stream.
@Override
public void send(Object item, Type type) throws VException {
this.stream.send(item, type);
}
@Override
public Object recv(Type type) throws EOFException, VException {
return this.stream.recv(type);
}
// Implements io.v.v23.rpc.ServerCall.
@Override
public Blessings grantedBlessings() {
return serverCall.grantedBlessings();
}
@Override
public Server server() {
return serverCall.server();
}
// Implements io.v.v23.rpc.ServerCall.
@Override
public Call security() {
return serverCall.security();
}
@Override
public String suffix() {
return this.serverCall.suffix();
}
@Override
public Endpoint localEndpoint() {
return this.serverCall.localEndpoint();
}
@Override
public Endpoint remoteEndpoint() {
return this.serverCall.remoteEndpoint();
}
// Implements java.lang.Object.
@Override
protected void finalize() {
nativeFinalize(this.nativePtr);
}
}