org.openl.util.IOUtils.closeQuietly()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.openl.util.IOUtils.closeQuietly()方法的一些代码示例,展示了IOUtils.closeQuietly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.closeQuietly()方法的具体详情如下:
包路径:org.openl.util.IOUtils
类名称:IOUtils
方法名:closeQuietly

IOUtils.closeQuietly介绍

[英]Unconditionally close a Closeable.

Equivalent to Closeable#close(), except any exceptions will be ignored.
[中]无条件关闭Closeable
与Closeable#close()等效,但任何异常都将被忽略。

代码示例

代码示例来源:origin: org.openl.rules/org.openl.rules.ruleservice.deployer

@Override
  public void close() {
    if (deployRepo instanceof Closeable) {
      // Close repo connection after validation
      IOUtils.closeQuietly((Closeable) deployRepo);
    }
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

@Override
  public void close() {
    if (deployRepo instanceof Closeable) {
      // Close repo connection after validation
      IOUtils.closeQuietly((Closeable) deployRepo);
    }
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

@Override
public void close() {
  IOUtils.closeQuietly(openedStream);
  openedStream = null;
}

代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr.jackrabbit

private static boolean isFileLocked(File file) {
  FileInputStream fileInputStream = null;
  try {
    fileInputStream = new FileInputStream(file);
    fileInputStream.read();
    return false;
  } catch (IOException e) {
    return true;
  } finally {
    IOUtils.closeQuietly(fileInputStream);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public void releaseRepository(String propertiesFileName) throws RRepositoryException {
  synchronized (this) {
    Repository repository = factories.get(propertiesFileName);
    if (repository != null) {
      if (repository instanceof Closeable) {
        // Close repo connection after validation
        IOUtils.closeQuietly((Closeable) repository);
      }
      factories.remove(propertiesFileName);
    }
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public void destroy() throws RRepositoryException {
  synchronized (this) {
    for (Repository repository : factories.values()) {
      if (repository instanceof Closeable) {
        // Close repo connection after validation
        IOUtils.closeQuietly((Closeable) repository);
      }
    }
    factories.clear();
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public void destroy() {
  synchronized (this) {
    for (Repository repository : factories.values()) {
      if (repository instanceof Closeable) {
        // Close repo connection after validation
        IOUtils.closeQuietly((Closeable) repository);
      }
    }
    factories.clear();
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public void releaseRepository(String propertiesFileName) {
  synchronized (this) {
    Repository repository = factories.get(propertiesFileName);
    if (repository != null) {
      if (repository instanceof Closeable) {
        // Close repo connection after validation
        IOUtils.closeQuietly((Closeable) repository);
      }
      factories.remove(propertiesFileName);
    }
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

private static boolean isFileLocked(File file) {
  FileInputStream fileInputStream = null;
  try {
    fileInputStream = new FileInputStream(file);
    fileInputStream.read();
    return false;
  } catch (IOException e) {
    return true;
  } finally {
    IOUtils.closeQuietly(fileInputStream);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

private boolean isEmptyZip(File uploadedFile) {
  ZipInputStream zipInputStream = null;
  try {
    zipInputStream = new ZipInputStream(new FileInputStream(uploadedFile), charset);
    if (zipInputStream.getNextEntry() == null) {
      return true;
    }
  } catch (IOException ignored) {
  } finally {
    IOUtils.closeQuietly(zipInputStream);
  }
  return false;
}

代码示例来源:origin: openl-tablets/openl-tablets

private Properties loadVelocityProperties() throws IOException, FileNotFoundException {
  Properties properties = new Properties();
  FileInputStream is = new FileInputStream(new File(VELOCITY_PROPERTIES));
  properties.load(is);
  IOUtils.closeQuietly(is);
  return properties;
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

@Override
public void destroy() {
  for (ProjectFile file : files) {
    IOUtils.closeQuietly(file.getInput());
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

@Override
public void destroy() {
  for (ProjectFile file : files) {
    IOUtils.closeQuietly(file.getInput());
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public void setSupportedVersion(File projectFolder, SupportedVersion version) throws IOException {
  Properties properties = new Properties();
  properties.setProperty(OPENL_COMPATIBILITY_VERSION, version.getVersion());
  FileOutputStream os = null;
  try {
    File file = new File(projectFolder, OPENL_PROJECT_PROPERTIES_FILE);
    os = new FileOutputStream(file);
    properties.store(os, "Openl project properties");
    os.close();
  } finally {
    IOUtils.closeQuietly(os);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.project

public ProjectDescriptor readOriginalDescriptor(File filename) throws FileNotFoundException, ValidationException {
  FileInputStream inputStream = new FileInputStream(filename);
  ProjectDescriptor descriptor = readDescriptorInternal(inputStream);
  IOUtils.closeQuietly(inputStream);
  validator.validate(descriptor);
  return descriptor;
}

代码示例来源:origin: openl-tablets/openl-tablets

public ProjectDescriptor readOriginalDescriptor(File filename) throws FileNotFoundException, ValidationException {
  FileInputStream inputStream = new FileInputStream(filename);
  ProjectDescriptor descriptor = readDescriptorInternal(inputStream);
  IOUtils.closeQuietly(inputStream);
  validator.validate(descriptor);
  return descriptor;
}

代码示例来源:origin: org.openl.rules/org.openl.rules.project

public ProjectDescriptor readDescriptor(File file) throws IOException, ValidationException {
  FileInputStream inputStream = new FileInputStream(file);
  ProjectDescriptor descriptor = readDescriptorInternal(inputStream);
  IOUtils.closeQuietly(inputStream);
  postProcess(descriptor, file);
  validator.validate(descriptor);
  return descriptor;
}

代码示例来源:origin: openl-tablets/openl-tablets

public void setContent(InputStream inputStream) throws ProjectException {
  FileOutputStream fos = null;
  try {
    fos = new FileOutputStream(source);
    IOUtils.copy(inputStream, fos);
    notifyModified();
  } catch (IOException e) {
    throw new ProjectException("Failed to set content.", e);
  } finally {
    IOUtils.closeQuietly(fos);
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public ProjectDescriptor readDescriptor(File file) throws IOException, ValidationException {
  FileInputStream inputStream = new FileInputStream(file);
  ProjectDescriptor descriptor = readDescriptorInternal(inputStream);
  IOUtils.closeQuietly(inputStream);
  postProcess(descriptor, file);
  validator.validate(descriptor);
  return descriptor;
}

代码示例来源:origin: openl-tablets/openl-tablets

public void setContent(InputStream inputStream) throws ProjectException {
  try {
    getProject().lock();
    setFileData(getRepository().save(getFileData(), inputStream));
  } catch (IOException ex) {
    throw new ProjectException("Cannot set content", ex);
  } finally {
    IOUtils.closeQuietly(inputStream);
  }
}

相关文章

微信公众号

最新文章

更多