ForwardingOs.java revision 9a3f363523000704205df288f8b6f2f48c0d8563
1/*
2 * Copyright (C) 2011 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
17package libcore.io;
18
19import java.io.FileDescriptor;
20
21/**
22 * Subclass this if you want to override some {@link Os} methods but otherwise delegate.
23 */
24public class ForwardingOs implements Os {
25    protected final Os os;
26
27    public ForwardingOs(Os os) {
28        this.os = os;
29    }
30
31    public boolean access(String path, int mode) throws ErrnoException { return os.access(path, mode); }
32    public String[] environ() { return os.environ(); }
33    public void fdatasync(FileDescriptor fd) throws ErrnoException { os.fdatasync(fd); }
34    public StructStat fstat(FileDescriptor fd) throws ErrnoException { return os.fstat(fd); }
35    public void fsync(FileDescriptor fd) throws ErrnoException { os.fsync(fd); }
36    public void ftruncate(FileDescriptor fd, long length) throws ErrnoException { os.ftruncate(fd, length); }
37    public String getenv(String name) { return os.getenv(name); }
38    public boolean isatty(FileDescriptor fd) { return os.isatty(fd); }
39    public long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException { return os.lseek(fd, offset, whence); }
40    public StructStat lstat(String path) throws ErrnoException { return os.lstat(path); }
41    public StructStat stat(String path) throws ErrnoException { return os.stat(path); }
42    public String strerror(int errno) { return os.strerror(errno); }
43    public long sysconf(int name) { return os.sysconf(name); }
44}
45