1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.io;
18
19 import java.io.IOException;
20 import java.nio.channels.SelectionKey;
21 import java.nio.channels.Selector;
22 import java.nio.channels.spi.SelectorProvider;
23 import java.util.Set;
24
25 /**
26 * Extends {@link Selector} with no-ops for testing.
27 */
28 public class SelectorAdapter extends Selector {
29
30 @Override
31 public void close() throws IOException {
32 }
33
34 @Override
35 public boolean isOpen() {
36 return false;
37 }
38
39 @Override
40 public Set<SelectionKey> keys() {
41 return null;
42 }
43
44 @Override
45 public SelectorProvider provider() {
46 return null;
47 }
48
49 @Override
50 public int select() throws IOException {
51 return 0;
52 }
53
54 @Override
55 public int select(final long timeout) throws IOException {
56 return 0;
57 }
58
59 @Override
60 public Set<SelectionKey> selectedKeys() {
61 return null;
62 }
63
64 @Override
65 public int selectNow() throws IOException {
66 return 0;
67 }
68
69 @Override
70 public Selector wakeup() {
71 return null;
72 }
73
74 }