blob: 1ab8f032e4ea20d95350c5223a0ecf4cbe195bd3 [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.v23.vdl;
import io.v.v23.verror.VException;
import java.io.EOFException;
/**
* A bidirectional stream with send/receive arguments of the specified type.
**/
public interface TypedStream<SendT, RecvT> {
/**
* Places the item onto the output stream, blocking if there is no buffer
* space available.
*
* @param item an item to be sent
* @throws VException if there was an error sending the item.
*/
void send(SendT item) throws VException;
/**
* Returns the next item in the input stream, blocking until an item is available.
* An EOFException will be thrown if a graceful end of input has been reached.
*
* @return RecvT next item in the input stream
* @throws EOFException if a graceful end of input has been reached
* @throws VException if there was an error receiving an item
*/
RecvT recv() throws EOFException, VException;
}