Tabnine Logo
RamFileSystemConfigBuilder
Code IndexAdd Tabnine to your IDE (free)

How to use
RamFileSystemConfigBuilder
in
org.apache.commons.vfs2.provider.ram

Best Java code snippets using org.apache.commons.vfs2.provider.ram.RamFileSystemConfigBuilder (Showing top 20 results out of 315)

origin: org.apache.commons/commons-vfs2

/**
 * Defaults to {@link Integer#MAX_VALUE}.
 *
 * @param opts The FileSystem options.
 * @return The maximum size of the file.
 * @see #setMaxSize(FileSystemOptions, long)
 * @since 2.1
 */
public long getLongMaxSize(final FileSystemOptions opts) {
  return getLong(opts, MAX_SIZE_KEY, Long.MAX_VALUE);
}
origin: org.apache.commons/commons-vfs2

/**
 * Sets the maximum size of the file system.
 *
 * @param opts The FileSystem options.
 * @param sizeInBytes The maximum file size.
 */
public void setMaxSize(final FileSystemOptions opts, final long sizeInBytes) {
  setParam(opts, MAX_SIZE_KEY, Long.valueOf(sizeInBytes));
}
origin: com.github.abashev/commons-vfs2

/**
 * @param newSize
 * @throws IOException if the new size exceeds the limit
 */
synchronized void resize(final long newSize) throws IOException {
  final RamFileSystem afs = getAbstractFileSystem();
  final FileSystemOptions afsOptions = afs.getFileSystemOptions();
  if (afsOptions != null) {
    final long maxSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(afsOptions);
    if (afs.size() + newSize - this.size() > maxSize) {
      throw new IOException("FileSystem capacity (" + maxSize + ") exceeded.");
    }
  }
  this.data.resize(newSize);
}
origin: org.apache.commons/commons-vfs2

@Before
public void setUp() throws Exception {
  manager = new DefaultFileSystemManager();
  manager.addProvider("ram", new RamFileProvider());
  manager.init();
  // File Systems Options
  RamFileSystemConfigBuilder.getInstance().setMaxSize(zeroSizedFso, 0L);
  RamFileSystemConfigBuilder.getInstance().setMaxSize(smallSizedFso, 10L);
}
origin: org.apache.commons/commons-vfs2

/**
 * @param newSize
 * @throws IOException if the new size exceeds the limit
 */
synchronized void resize(final long newSize) throws IOException {
  final RamFileSystem afs = getAbstractFileSystem();
  final FileSystemOptions afsOptions = afs.getFileSystemOptions();
  if (afsOptions != null) {
    final long maxSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(afsOptions);
    if (afs.size() + newSize - this.size() > maxSize) {
      throw new IOException("FileSystem capacity (" + maxSize + ") exceeded.");
    }
  }
  this.data.resize(newSize);
}
origin: org.jetbrains.intellij.deps/commons-vfs2

@Before
public void setUp() throws Exception
{
  manager = new DefaultFileSystemManager();
  manager.addProvider("ram", new RamFileProvider());
  manager.init();
  // File Systems Options
  RamFileSystemConfigBuilder.getInstance().setMaxSize(zeroSizedFso, 0L);
  RamFileSystemConfigBuilder.getInstance().setMaxSize(smallSizedFso, 10L);
}
origin: apache/commons-vfs

/**
 * @param newSize
 * @throws IOException if the new size exceeds the limit
 */
synchronized void resize(final long newSize) throws IOException {
  final RamFileSystem afs = getAbstractFileSystem();
  final FileSystemOptions afsOptions = afs.getFileSystemOptions();
  if (afsOptions != null) {
    final long maxSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(afsOptions);
    if (afs.size() + newSize - this.size() > maxSize) {
      throw new IOException("FileSystem capacity (" + maxSize + ") exceeded.");
    }
  }
  this.data.resize(newSize);
}
origin: apache/commons-vfs

@Before
public void setUp() throws Exception {
  manager = new DefaultFileSystemManager();
  manager.addProvider("ram", new RamFileProvider());
  manager.init();
  // File Systems Options
  RamFileSystemConfigBuilder.getInstance().setMaxSize(zeroSizedFso, 0L);
  RamFileSystemConfigBuilder.getInstance().setMaxSize(smallSizedFso, 10L);
}
origin: com.github.abashev/commons-vfs2

/**
 * Defaults to {@link Integer#MAX_VALUE}.
 *
 * @param opts The FileSystem options.
 * @return The maximum size of the file.
 * @see #setMaxSize(FileSystemOptions, long)
 * @since 2.1
 */
public long getLongMaxSize(final FileSystemOptions opts) {
  return getLong(opts, MAX_SIZE_KEY, Long.MAX_VALUE);
}
origin: org.jetbrains.intellij.deps/commons-vfs2

/**
 * Sets the maximum size of the file system.
 *
 * @param opts The FileSystem options.
 * @param sizeInBytes The maximum file size.
 */
public void setMaxSize(final FileSystemOptions opts, final long sizeInBytes)
{
  setParam(opts, MAX_SIZE_KEY, Long.valueOf(sizeInBytes));
}
origin: org.jetbrains.intellij.deps/commons-vfs2

/**
 * @param newSize
 * @throws IOException
 *             if the new size exceeds the limit
 */
synchronized void resize(final long newSize) throws IOException
{
  final RamFileSystem afs = getAbstractFileSystem();
  final FileSystemOptions afsOptions = afs.getFileSystemOptions();
  if (afsOptions != null)
  {
    final long maxSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(afsOptions);
    if (afs.size() + newSize - this.size() > maxSize)
    {
      throw new IOException("FileSystem capacity (" + maxSize + ") exceeded.");
    }
  }
  this.data.resize(newSize);
}
origin: apache/commons-vfs

/**
 * Defaults to {@link Integer#MAX_VALUE}.
 *
 * @param opts The FileSystem options.
 * @return The maximum size of the file.
 * @see #setMaxSize(FileSystemOptions, long)
 * @since 2.1
 */
public long getLongMaxSize(final FileSystemOptions opts) {
  return getLong(opts, MAX_SIZE_KEY, Long.MAX_VALUE);
}
origin: com.github.abashev/commons-vfs2

/**
 * Sets the maximum size of the file system.
 *
 * @param opts The FileSystem options.
 * @param sizeInBytes The maximum file size.
 */
public void setMaxSize(final FileSystemOptions opts, final long sizeInBytes) {
  setParam(opts, MAX_SIZE_KEY, Long.valueOf(sizeInBytes));
}
origin: org.apache.commons/commons-vfs2

@Test
public void testFSOptions() throws Exception {
  // Default FS
  final FileObject fo1 = manager.resolveFile("ram:/");
  final FileObject fo2 = manager.resolveFile("ram:/");
  assertTrue("Both files should exist in the same fs instance.", fo1.getFileSystem() == fo2.getFileSystem());
  FileSystemOptions fsOptions = fo1.getFileSystem().getFileSystemOptions();
  long maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be unlimited", Long.MAX_VALUE, maxFilesystemSize);
  // Small FS
  final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
  final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso);
  assertTrue("Both files should exist in the same FileSystem instance.",
      fo3.getFileSystem() == fo4.getFileSystem());
  assertTrue("Both files should exist in different FileSystem instance.",
      fo1.getFileSystem() != fo3.getFileSystem());
  fsOptions = fo3.getFileSystem().getFileSystemOptions();
  maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be set", 10, maxFilesystemSize);
}
origin: org.jetbrains.intellij.deps/commons-vfs2

/**
 * Defaults to {@link Integer#MAX_VALUE}.
 *
 * @param opts The FileSystem options.
 * @return The maximum size of the file.
 * @see #setMaxSize(FileSystemOptions, long)
 * @since 2.1
 */
public long getLongMaxSize(final FileSystemOptions opts)
{
  return getLong(opts, MAX_SIZE_KEY, Long.MAX_VALUE);
}
origin: apache/commons-vfs

/**
 * Sets the maximum size of the file system.
 *
 * @param opts The FileSystem options.
 * @param sizeInBytes The maximum file size.
 */
public void setMaxSize(final FileSystemOptions opts, final long sizeInBytes) {
  setParam(opts, MAX_SIZE_KEY, Long.valueOf(sizeInBytes));
}
origin: org.jetbrains.intellij.deps/commons-vfs2

@Test
public void testFSOptions() throws Exception
{
  // Default FS
  final FileObject fo1 = manager.resolveFile("ram:/");
  final FileObject fo2 = manager.resolveFile("ram:/");
  assertTrue("Both files should exist in the same fs instance.", fo1.getFileSystem() == fo2.getFileSystem());
  FileSystemOptions fsOptions = fo1.getFileSystem().getFileSystemOptions();
  long maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be unlimited", Long.MAX_VALUE, maxFilesystemSize);
  // Small FS
  final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
  final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso);
  assertTrue("Both files should exist in the same FileSystem instance.", fo3.getFileSystem() == fo4.getFileSystem());
  assertTrue("Both files should exist in different FileSystem instance.", fo1.getFileSystem() != fo3.getFileSystem());
  fsOptions = fo3.getFileSystem().getFileSystemOptions();
  maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be set", 10, maxFilesystemSize);
}
origin: com.github.abashev/commons-vfs2

/**
 * Defaults to {@link Integer#MAX_VALUE}.
 *
 * @param opts The FileSystem options.
 * @return The maximum size of the file. The next major version will change the return type to a long.
 * @see #setMaxSize(FileSystemOptions, int)
 */
public int getMaxSize(final FileSystemOptions opts) {
  return getLong(opts, MAX_SIZE_KEY, Long.valueOf(Integer.MAX_VALUE)).intValue();
}
origin: org.apache.commons/commons-vfs2

/**
 * Sets the maximum size of the file system.
 *
 * @param opts The FileSystem options.
 * @param sizeInBytes The maximum file size.
 * @deprecated Use {@link #setMaxSize(FileSystemOptions, long)}
 */
@Deprecated
public void setMaxSize(final FileSystemOptions opts, final int sizeInBytes) {
  setParam(opts, MAX_SIZE_KEY, Long.valueOf(sizeInBytes));
}
origin: apache/commons-vfs

@Test
public void testFSOptions() throws Exception {
  // Default FS
  final FileObject fo1 = manager.resolveFile("ram:/");
  final FileObject fo2 = manager.resolveFile("ram:/");
  assertTrue("Both files should exist in the same fs instance.", fo1.getFileSystem() == fo2.getFileSystem());
  FileSystemOptions fsOptions = fo1.getFileSystem().getFileSystemOptions();
  long maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be unlimited", Long.MAX_VALUE, maxFilesystemSize);
  // Small FS
  final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
  final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso);
  assertTrue("Both files should exist in the same FileSystem instance.",
      fo3.getFileSystem() == fo4.getFileSystem());
  assertTrue("Both files should exist in different FileSystem instance.",
      fo1.getFileSystem() != fo3.getFileSystem());
  fsOptions = fo3.getFileSystem().getFileSystemOptions();
  maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
  assertEquals("Filesystem option maxSize must be set", 10, maxFilesystemSize);
}
org.apache.commons.vfs2.provider.ramRamFileSystemConfigBuilder

Javadoc

Config Builder for the RAM filesystem.

Most used methods

  • getInstance
    Gets the singleton builder.
  • getLongMaxSize
    Defaults to Integer#MAX_VALUE.
  • getLong
  • setParam
  • setMaxSize
    Sets the maximum size of the file system.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JList (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now