• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.nearby.fastpair.provider.simulator.testing;
18 
19 import com.google.protobuf.ByteString;
20 
21 import java.io.IOException;
22 
23 /**
24  * Opens input and output data channels, then provides read and write operations to the data
25  * channels.
26  */
27 public interface StreamIOHandler {
28     /**
29      * Reads stream data from the input channel.
30      *
31      * @return a protocol buffer contains the input message
32      * @throws IOException errors occur when reading the input stream
33      */
read()34     ByteString read() throws IOException;
35 
36     /**
37      * Writes stream data to the output channel.
38      *
39      * @param output a protocol buffer contains the output message
40      * @throws IOException errors occur when writing the output message to output stream
41      */
write(ByteString output)42     void write(ByteString output) throws IOException;
43 }
44