congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
NestedIOException
Code IndexAdd Tabnine to your IDE (free)

How to use
NestedIOException
in
leap.lang.exception

Best Java code snippets using leap.lang.exception.NestedIOException (Showing top 20 results out of 315)

origin: org.leapframework/leap-lang

public static NestedIOException wrap(IOException e){
  return new NestedIOException(e);
}

origin: org.leapframework/jmms-engine

private File getDir(Resource resource) {
  File file = null;
  try {
    file = resource.getFile();
  } catch (NestedIOException e) {
    if (!(e.getIOException() instanceof FileNotFoundException)) {
      throw e;
    }
  }
  return file;
}
origin: org.leapframework/leap-lang

public IOException getIOException(){
  return (IOException)getCause();
}
origin: org.leapframework/leap-lang

public static void wrapAndThrow(IOException e){
  throw new NestedIOException(e);
}

origin: org.leapframework/leap-spring-boot

@Override
public File getFile() throws IOException {
  try{
    File file = wrapped.getFile();
    if(null == file) {
      throw new FileNotFoundException("Resource '" + getDescription() + "' is not a file");
    }
    return file;
  }catch (NestedIOException e) {
    throw e.getIOException();
  }
}
origin: org.leapframework/leap-lang

public static NestedIOException wrap(String message,IOException e){
  return new NestedIOException(message,e);
}

origin: org.leapframework/jmms-engine

private void addWatchDir(List<File> dirs, Resource resource) {
  if(null == resource || !resource.exists()) {
    return;
  }
  File file = null;
  try {
    file = resource.getFile();
  } catch (NestedIOException e) {
    if (!(e.getIOException() instanceof FileNotFoundException)) {
      throw e;
    }
  }
  if(null != file && file.isDirectory()) {
    dirs.add(file);
  }
}
origin: org.leapframework/leap-lang

public static void wrapAndThrow(String message,IOException e){
  throw new NestedIOException(message,e);
}

origin: org.leapframework/leap-lang

public static XmlReader createReader(File file) {
  try{
    return createStaxReader(new InputStreamReader(new FileInputStream(file), Charsets.UTF_8),file.getAbsolutePath());
  }catch(IOException e){
    throw new NestedIOException(e);
  }
}

origin: org.leapframework/leap-lang

  @Override
  public void run() {
    try {
      scan(result,rootResourceToScan,rootDirPath,subPattern);
    } catch (IOException e) {
      throw new NestedIOException(e);
    }
  }
}));
origin: org.leapframework/leap-lang

public static XmlDocument load(File file) {
  InputStreamReader reader = null;
  try{
    reader = new InputStreamReader(new FileInputStream(file),Charsets.UTF_8);
    
    Document doc = parseDocument(reader);
    
    return new DomDocument(doc,file.getAbsolutePath());
  }catch(IOException e){
    throw new NestedIOException(e.getMessage(),e);
  }finally{
    IO.close(reader);
  }
}

origin: org.leapframework/leap-lang

public static XmlReader createReader(Resource resource) {
  try{
    String resourceLocation = resource.toString();
    return createStaxReader(new InputStreamReader(resource.getInputStream(), Charsets.UTF_8),resourceLocation);
  }catch(IOException e){
    throw new NestedIOException(e);
  }
}

origin: org.leapframework/leap-lang

@Override
public Resource[] searchUrls(String... locationPatterns) {
  Args.notNull(locationPatterns,"location patterns");
  
  Set<Resource> resources = new LinkedHashSet<Resource>();
  
  for(String locationPattern : locationPatterns){
    try {
      for(int i=0;i<values.length;i++){
        Resource resource = values[i];
        
        if(Resources.matcher.match(locationPattern,resource.getURL().toExternalForm())){
          resources.add(resource);
        }
      }
    } catch (IOException e) {
      throw new NestedIOException(e);
    }
  }
  return resources.toArray(new Resource[resources.size()]);
}

origin: org.leapframework/leap-lang

  @Override
  public void run() {
    try {
      final DefaultResourceScanner resourceScanner = new DefaultResourceScanner(loader);
      resourceScanner.setExecutorService(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));                            
      Collections2.addAll(result, resourceScanner.scan(locationPattern));
      resourceScanner.getExecutorService().shutdownNow();
    } catch (IOException e) {
      throw new NestedIOException(e);
    }
  }
}));
origin: org.leapframework/leap-lang

/**
 * scan all the resources match the given location pattern.
 * 
 * @see ResourceScanner#scan(String)
 * 
 * @throws NestedIOException if an {@link IOException} thrown by underlying scanner.
 */
public static ResourceSet scan(String locationPattern) throws NestedIOException {
  try {
    return new SimpleResourceSet(scanner.scan(locationPattern));
  } catch (IOException e) {
    throw new NestedIOException(e);
  }
}

origin: org.leapframework/leap-lang

private static Properties readProperties(Resource resource) {
  InputStream    is = null;
  try{
    is = resource.getInputStream();
    
    Properties properties = new Properties();
    
    if(Strings.endsWithIgnoreCase(resource.getFilename(),".xml")){
      properties.loadFromXML(is);
    }else{
      properties.load(is);
    }
    
    return properties;
  }catch(IOException e){
    throw new NestedIOException(e);
  }finally{
    IO.close(is);
  }
}

origin: org.leapframework/leap-lang

public static Resource getResource(Resource current,String path) throws NestedIOException{
  Args.notNull(current,"current resource");
  Args.notNull(path,"resource path");
  try {
    if(path.indexOf(':') > 0 || path.startsWith("/")){
      return Resources.getResource(path);
    }else{
      return current.createRelative(path);
    }
  } catch (IOException e) {
    throw new NestedIOException(e);
  }
}

origin: org.leapframework/leap-lang

/**
 * Saving the given {@link Properties} to the given file use default charset {@link Charsets#defaultCharset()}.
 * 
 * @throws NestedIOException if an I/O error occurs.
 */
public static void save(Properties props, File file) throws NestedIOException {
  Args.notNull(props,"properties");
  Args.notNull(file,"file");
  try{
    if(!file.exists()){
      file.createNewFile();
    }
    
    if(Strings.endsWithIgnoreCase(file.getName(), ".xml")){
      try(OutputStream out = new FileOutputStream(file)){
        props.storeToXML(out, "");	
      }
    }else{
      try(Writer writer = IO.createWriter(file)){
        props.store(writer, "");
      }
    }
  }catch(IOException e){
    throw new NestedIOException("Error saving properties file '" + file.getAbsolutePath() + "', " + e.getMessage(), e);
  }
}

origin: org.leapframework/leap-lang

public static XmlDocument load(Resource resource) throws NestedIOException {
  InputStreamReader reader = null;
  try{
    reader = resource.getInputStreamReader();
    
    Document doc = parseDocument(reader);
    
    return new DomDocument(doc,null == resource.getURL() ? null : resource.getURL().toString());
  }catch(IOException e){
    throw new NestedIOException(e.getMessage(),e);
  }finally{
    IO.close(reader);
  }
}

origin: org.leapframework/leap-lang

/**
 * Reads the given properties file.
 * 
 * @throws NestedIOException if an I/O error occurs.
 */
public static ExProperties load(File file,Properties defaults) throws NestedIOException {
  Args.notNull(file,"file");
  try {
    ExProperties props = null == defaults ? new ExProperties(file) : new ExProperties(file,defaults);
    if(Strings.endsWithIgnoreCase(file.getName(), ".xml")){
      try(InputStream in = new FileInputStream(file)){
        props.loadFromXML(in);    
      }
    }else{
      try(Reader reader = IO.createReader(file,Charset.defaultCharset())){
        props.load(reader);
      }
    }
    return props;
  } catch (IOException e) {
    throw new NestedIOException("Error loading properties file '" + file.getAbsolutePath() + "', " + e.getMessage(), e);
  }
}

leap.lang.exceptionNestedIOException

Most used methods

  • <init>
  • getIOException
  • getCause

Popular in Java

  • Running tasks concurrently on multiple threads
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Reference (javax.naming)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JButton (javax.swing)
  • JCheckBox (javax.swing)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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