Tabnine Logo
ResourceReferenceUtilities.getFile
Code IndexAdd Tabnine to your IDE (free)

How to use
getFile
method
in
net.anwiba.commons.reference.ResourceReferenceUtilities

Best Java code snippets using net.anwiba.commons.reference.ResourceReferenceUtilities.getFile (Showing top 5 results out of 315)

origin: net.anwiba.commons/anwiba-commons-reference

@Override
public File getFile(final IResourceReference resourceReference) throws URISyntaxException {
 return ResourceReferenceUtilities.getFile(resourceReference);
}
origin: net.anwiba.commons/anwiba-commons-core

@Override
public File getFile(final IResourceReference resourceReference) throws URISyntaxException {
 return ResourceReferenceUtilities.getFile(resourceReference);
}
origin: net.anwiba.commons/anwiba-commons-swing-core

private boolean isAccepted(final ImageFileFilter fileFilter, final IResourceReference imageFile) {
 try {
  if (ResourceReferenceUtilities.isFileSystemResource(imageFile)) {
   final File file = ResourceReferenceUtilities.getFile(imageFile);
   return file != null && file.isFile() && fileFilter.accept(file);
  }
  return imageFile != null;
 } catch (final URISyntaxException exception) {
  return false;
 }
}
origin: net.anwiba.commons/anwiba-commons-core

 @Override
 public IResourceReference restore(final IResourceReference resourceReference) throws IOException {
  try {
   if (!ResourceReferenceUtilities.isFileSystemResource(resourceReference)) {
    throw new IOException("Unsupported resource"); //$NON-NLS-1$
   }
   final File file = ResourceReferenceUtilities.getFile(resourceReference);
   final File backup = new File(file.getPath() + "~"); //$NON-NLS-1$
   if (backup.exists()) {
    Files.copy(backup.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
    if (!file.exists()) {
     throw new IOException("Coudn't restore file " + file); //$NON-NLS-1$
    }
    return new ResourceReferenceFactory().create(backup);
   }
   return null;
  } catch (final URISyntaxException exception) {
   throw new IOException(exception.getLocalizedMessage(), exception);
  }
 }
}
origin: net.anwiba.commons/anwiba-commons-reference

 @Override
 public IResourceReference restore(final IResourceReference resourceReference) throws IOException {
  try {
   if (!ResourceReferenceUtilities.isFileSystemResource(resourceReference)) {
    throw new IOException("Unsupported resource"); //$NON-NLS-1$
   }
   final File file = ResourceReferenceUtilities.getFile(resourceReference);
   final File backup = new File(file.getPath() + "~"); //$NON-NLS-1$
   if (backup.exists()) {
    Files.copy(backup.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
    if (!file.exists()) {
     throw new IOException("Coudn't restore file " + file); //$NON-NLS-1$
    }
    return new ResourceReferenceFactory().create(backup);
   }
   return null;
  } catch (final URISyntaxException exception) {
   throw new IOException(exception.getLocalizedMessage(), exception);
  }
 }
}
net.anwiba.commons.referenceResourceReferenceUtilitiesgetFile

Popular methods of ResourceReferenceUtilities

  • isFileSystemResource
  • toString
  • getExtension
  • getPath
  • getUri
  • getUrl
  • isMemoryResource

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Runner (org.openjdk.jmh.runner)
  • 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