001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.vfs2.provider.ram; 018 019import java.util.Arrays; 020import java.util.Collection; 021import java.util.Collections; 022 023import org.apache.commons.vfs2.Capability; 024import org.apache.commons.vfs2.FileName; 025import org.apache.commons.vfs2.FileSystem; 026import org.apache.commons.vfs2.FileSystemException; 027import org.apache.commons.vfs2.FileSystemOptions; 028import org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider; 029 030/** 031 * RAM File Provider. 032 */ 033public class RamFileProvider extends AbstractOriginatingFileProvider { 034 035 /** The provider's capabilities. */ 036 public static final Collection<Capability> capabilities = Collections.unmodifiableCollection( 037 Arrays.asList(Capability.CREATE, Capability.DELETE, Capability.RENAME, Capability.GET_TYPE, 038 Capability.GET_LAST_MODIFIED, Capability.SET_LAST_MODIFIED_FILE, 039 Capability.SET_LAST_MODIFIED_FOLDER, Capability.LIST_CHILDREN, Capability.READ_CONTENT, 040 Capability.URI, Capability.WRITE_CONTENT, Capability.APPEND_CONTENT, Capability.RANDOM_ACCESS_READ, 041 Capability.RANDOM_ACCESS_SET_LENGTH, Capability.RANDOM_ACCESS_WRITE)); 042 043 /** 044 * Constructs a new provider. 045 */ 046 public RamFileProvider() { 047 } 048 049 /* 050 * (non-Javadoc) 051 * 052 * @see org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider#doCreateFileSystem( 053 * org.apache.commons.vfs2.FileName, org.apache.commons.vfs2.FileSystemOptions) 054 */ 055 @Override 056 protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) 057 throws FileSystemException { 058 return new RamFileSystem(name, fileSystemOptions); 059 } 060 061 /* 062 * (non-Javadoc) 063 * 064 * @see org.apache.commons.vfs2.provider.FileProvider#getCapabilities() 065 */ 066 @Override 067 public Collection<Capability> getCapabilities() { 068 return capabilities; 069 } 070}