aboutsummaryrefslogtreecommitdiff
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/FileStoreAdapter.java
blob: 0f4e87e9f96454def34a8a66faa7e68f21b397c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Eclipse Public License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.eclipse.org/org/documents/epl-v10.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.ide.eclipse.adt.internal.wizards.newproject;

import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;

/**
 * IFileStore implementation that delegates to the give {@link IFileStore}.
 * This makes it easier to just override a single method from a store.
 */
class FileStoreAdapter implements IFileStore {

    private final IFileStore mStore;

    public FileStoreAdapter(IFileStore store) {
        mStore = store;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public Object getAdapter(Class adapter) {
        return mStore.getAdapter(adapter);
    }

    @Override
    public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException {
        return mStore.childInfos(options, monitor);
    }

    @Override
    public String[] childNames(int options, IProgressMonitor monitor)
            throws CoreException {
        return mStore.childNames(options, monitor);
    }

    @Override
    public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
        return mStore.childStores(options, monitor);
    }

    @Override
    public void copy(IFileStore destination, int options, IProgressMonitor monitor)
            throws CoreException {
        mStore.copy(destination, options, monitor);
    }

    @Override
    public void delete(int options, IProgressMonitor monitor) throws CoreException {
        mStore.delete(options, monitor);
    }

    @Override
    public IFileInfo fetchInfo() {
        return mStore.fetchInfo();
    }

    @Override
    public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
        return mStore.fetchInfo(options, monitor);
    }

    @Deprecated
    @Override
    public IFileStore getChild(IPath path) {
        return mStore.getChild(path);
    }

    @Override
    public IFileStore getFileStore(IPath path) {
        return mStore.getFileStore(path);
    }

    @Override
    public IFileStore getChild(String name) {
        return mStore.getChild(name);
    }

    @Override
    public IFileSystem getFileSystem() {
        return mStore.getFileSystem();
    }

    @Override
    public String getName() {
        return mStore.getName();
    }

    @Override
    public IFileStore getParent() {
        return mStore.getParent();
    }

    @Override
    public boolean isParentOf(IFileStore other) {
        return mStore.isParentOf(other);
    }

    @Override
    public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
        return mStore.mkdir(options, monitor);
    }

    @Override
    public void move(IFileStore destination, int options, IProgressMonitor monitor)
            throws CoreException {
        mStore.move(destination, options, monitor);
    }

    @Override
    public InputStream openInputStream(int options, IProgressMonitor monitor)
            throws CoreException {
        return mStore.openInputStream(options, monitor);
    }

    @Override
    public OutputStream openOutputStream(int options, IProgressMonitor monitor)
            throws CoreException {
        return mStore.openOutputStream(options, monitor);
    }

    @Override
    public void putInfo(IFileInfo info, int options, IProgressMonitor monitor)
            throws CoreException {
        mStore.putInfo(info, options, monitor);
    }

    @Override
    public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException {
        return mStore.toLocalFile(options, monitor);
    }

    @Override
    public URI toURI() {
        return mStore.toURI();
    }
}