diff options
author | Yohann Roussel <yroussel@google.com> | 2015-02-26 18:08:43 +0100 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2015-03-03 11:22:27 +0100 |
commit | 82dbcafa8a9071d54fb1fc49469f160fab0a3f61 (patch) | |
tree | ef872659fc3aebc86fcbd8a43d00733f50fac3b5 /sched/src/com/android/sched | |
parent | 4f8680254dd1ecee7baeb9a6efb2803410473468 (diff) | |
download | toolchain_jack-82dbcafa8a9071d54fb1fc49469f160fab0a3f61.tar.gz toolchain_jack-82dbcafa8a9071d54fb1fc49469f160fab0a3f61.tar.bz2 toolchain_jack-82dbcafa8a9071d54fb1fc49469f160fab0a3f61.zip |
Import meta and resources are now properties
Change-Id: I2f9795a826046ccfbeee5207597f31e633663958
Diffstat (limited to 'sched/src/com/android/sched')
-rw-r--r-- | sched/src/com/android/sched/util/codec/DirectoryInputVFSCodec.java | 62 | ||||
-rw-r--r-- | sched/src/com/android/sched/util/codec/InputVFSCodec.java | 2 |
2 files changed, 63 insertions, 1 deletions
diff --git a/sched/src/com/android/sched/util/codec/DirectoryInputVFSCodec.java b/sched/src/com/android/sched/util/codec/DirectoryInputVFSCodec.java new file mode 100644 index 00000000..e2904485 --- /dev/null +++ b/sched/src/com/android/sched/util/codec/DirectoryInputVFSCodec.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 + * + * 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.sched.util.codec; + + +import com.android.sched.util.file.Directory; +import com.android.sched.util.file.FileOrDirectory.Existence; +import com.android.sched.util.file.FileOrDirectory.Permission; +import com.android.sched.util.log.LoggerFactory; +import com.android.sched.vfs.DirectFS; +import com.android.sched.vfs.GenericInputVFS; +import com.android.sched.vfs.InputVFS; +import com.android.sched.vfs.VFS; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.annotation.Nonnull; + +/** + * This {@link StringCodec} is used to create an instance of {@link InputVFS} + * to directories. + */ +public class DirectoryInputVFSCodec extends InputVFSCodec + implements StringCodec<InputVFS> { + + @Nonnull + private final Logger logger = LoggerFactory.getLogger(); + + @Override + @Nonnull + public String getUsage() { + return "a path to a directory (" + getUsageDetails() + ")"; + } + + @Override + @Nonnull + public InputVFS checkString(@Nonnull CodecContext context, @Nonnull final String string) + throws ParsingException { + try { + VFS vfs = new DirectFS(new Directory(string, context.getRunnableHooks(), + Existence.MUST_EXIST, Permission.READ, change), Permission.READ); + return new GenericInputVFS(vfs); + } catch (IOException e) { + throw new ParsingException(e.getMessage(), e); + } + } +} diff --git a/sched/src/com/android/sched/util/codec/InputVFSCodec.java b/sched/src/com/android/sched/util/codec/InputVFSCodec.java index f0588d09..4406450b 100644 --- a/sched/src/com/android/sched/util/codec/InputVFSCodec.java +++ b/sched/src/com/android/sched/util/codec/InputVFSCodec.java @@ -69,7 +69,7 @@ public class InputVFSCodec extends FileOrDirCodec @Override @Nonnull public String getUsage() { - return "a path to an input directory or zip archive (" + getUsageDetails() + ")"; + return "a path to a directory or zip archive (" + getUsageDetails() + ")"; } @Override |