diff options
author | Xavier Ducrohet <xav@android.com> | 2012-10-24 17:02:47 -0700 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-24 17:02:47 -0700 |
commit | 0a6d8750c4330ad793f3beae670eb21e0e1d401b (patch) | |
tree | 226729f6f6181b6c867fbf6d06e89ca8a1dfcf6d /src/main/java/de/waldheinz/fs/FileSystemFactory.java | |
parent | 6950a7fcfda2d03446514e315b6bf6bd5c476496 (diff) | |
parent | 67fe07b509b35defe3a8c80d65ad5ae859ac354a (diff) | |
download | fat32lib-0a6d8750c4330ad793f3beae670eb21e0e1d401b.tar.gz |
Merge changes I50294fcc,Ie59bda0ctools_r21
* changes:
Added LGPL 2.1 NOTICE file and MODULE_LICENSE
External library with modifications. fat32-lib. Signed-off-by: Dan Galpin <dgalpin@google.com>
Diffstat (limited to 'src/main/java/de/waldheinz/fs/FileSystemFactory.java')
-rw-r--r-- | src/main/java/de/waldheinz/fs/FileSystemFactory.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/de/waldheinz/fs/FileSystemFactory.java b/src/main/java/de/waldheinz/fs/FileSystemFactory.java new file mode 100644 index 0000000..47cc438 --- /dev/null +++ b/src/main/java/de/waldheinz/fs/FileSystemFactory.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009,2010 Matthias Treydte <mt@waldheinz.de> + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package de.waldheinz.fs; + +import de.waldheinz.fs.fat.FatFileSystem; +import java.io.IOException; + +/** + * Factory for {@link FileSystem} instances. + * + * @author Matthias Treydte <waldheinz at gmail.com> + */ +public class FileSystemFactory { + + private FileSystemFactory() { } + + /** + * <p> + * Creates a new {@link FileSystem} for the specified {@code device}. When + * using this method, care must be taken that there is only one + * {@code FileSystems} accessing the specified {@link BlockDevice}. + * Otherwise severe file system corruption may occur. + * </p> + * + * @param device the device to create the file system for + * @param readOnly if the file system should be openend read-only + * @return a new {@code FileSystem} instance for the specified device + * @throws UnknownFileSystemException if the file system type could + * not be determined + * @throws IOException on read error + */ + public static FileSystem create(BlockDevice device, boolean readOnly) + throws UnknownFileSystemException, IOException { + + return FatFileSystem.read(device, readOnly); + } +} |