本文整理了Java中org.eclipse.persistence.internal.helper.Helper.close()
方法的一些代码示例,展示了Helper.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.close()
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:close
[英]Close a closeable object, eating the exception
[中]关闭可关闭的对象,吃掉异常
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* Returns true if the file of this name does indeed exist
*/
public static boolean doesFileExist(String fileName) {
FileReader reader = null;
try {
reader = new FileReader(fileName);
} catch (FileNotFoundException fnfException) {
return false;
} finally {
Helper.close(reader);
}
return true;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Returns true if the file of this name does indeed exist
*/
public static boolean doesFileExist(String fileName) {
FileReader reader = null;
try {
reader = new FileReader(fileName);
} catch (FileNotFoundException fnfException) {
return false;
} finally {
Helper.close(reader);
}
return true;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Returns true if the file of this name does indeed exist
*/
public static boolean doesFileExist(String fileName) {
FileReader reader = null;
try {
reader = new FileReader(fileName);
} catch (FileNotFoundException fnfException) {
return false;
} finally {
Helper.close(reader);
}
return true;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Write entry bytes into target, this method is usually invoked if class has been tranformed
* @param targetEntry
* @param entryBytes
* @throws IOException
*/
public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException{
FileOutputStream fos = null;
try {
File target = new File(this.target.getPath()+targetEntry.getName()).getAbsoluteFile();
if(!target.exists()) {
target.createNewFile();
}
fos = new FileOutputStream(target);
fos.write(entryBytes);
} finally {
Helper.close(fos);
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Write entry into target, this method usually copy original class into target.
* @param jis
* @param entry
* @throws IOException
*/
public void addEntry(InputStream jis,JarEntry entry) throws IOException,URISyntaxException {
File target = new File(this.target.getPath()+entry.getName()).getAbsoluteFile();
if(!target.exists()) {
target.createNewFile();
}
FileInputStream fis = null;
FileOutputStream fos = null;
try {
if((new File(Helper.toURI(this.source))).isDirectory()){
File sourceEntry = new File(this.source.getPath()+entry.getName());
fis = new FileInputStream(sourceEntry);
byte[] classBytes = new byte[fis.available()];
fis.read(classBytes);
fos = new FileOutputStream(target);
fos.write(classBytes);
}else{
readwriteStreams(jis,(new FileOutputStream(target)));
}
} finally {
Helper.close(fis);
Helper.close(fos);
}
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* PUBLIC:
* Use this method to generate stored procedures based on the dynamic SQL generated
* for your mappings and descriptors. This should be used with caution as it maintenance
* will be high. Stored procedures may be generated either directly on the database
* or to a file.
*/
public void generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName) throws EclipseLinkException {
java.io.FileWriter fileWriter = null;
try {
StoredProcedureGenerator storedProcedureGenerator = new StoredProcedureGenerator(this);
if (!(path.endsWith("\\") || path.endsWith("/"))) {
path = path + "\\";
}
String className = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf('.') + 1);
String packageName = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf('.'));
String fileName = path + className + ".java";
fileWriter = new java.io.FileWriter(fileName);
storedProcedureGenerator.generateStoredProcedures();
storedProcedureGenerator.generateAmendmentClass(fileWriter, packageName, className);
fileWriter.close();
} catch (java.io.IOException ioException) {
throw ValidationException.fileError(ioException);
} finally {
Helper.close(fileWriter);
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* PUBLIC:
* Use this method to generate stored procedures based on the dynamic SQL generated
* for your mappings and descriptors. This should be used with caution as it maintenance
* will be high. Stored procedures may be generated either directly on the database
* or to a file.
*/
public void generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName) throws EclipseLinkException {
java.io.FileWriter fileWriter = null;
try {
StoredProcedureGenerator storedProcedureGenerator = new StoredProcedureGenerator(this);
if (!(path.endsWith("\\") || path.endsWith("/"))) {
path = path + "\\";
}
String className = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf('.') + 1);
String packageName = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf('.'));
String fileName = path + className + ".java";
fileWriter = new java.io.FileWriter(fileName);
storedProcedureGenerator.generateStoredProcedures();
storedProcedureGenerator.generateAmendmentClass(fileWriter, packageName, className);
fileWriter.close();
} catch (java.io.IOException ioException) {
throw ValidationException.fileError(ioException);
} finally {
Helper.close(fileWriter);
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
jarOut.closeEntry();
} finally {
Helper.close(byteStream);
Helper.close(inStream);
Helper.close(jarOut);
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
jarOut.closeEntry();
} finally {
Helper.close(byteStream);
Helper.close(inStream);
Helper.close(jarOut);
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* PUBLIC:
* Use this method to generate stored procedures based on the dynamic SQL generated
* for your mappings and descriptors. This should be used with caution as it maintenance
* will be high. Stored procedures may be generated either directly on the database
* or to a file.
*/
public void generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName) throws EclipseLinkException {
java.io.FileWriter fileWriter = null;
try {
StoredProcedureGenerator storedProcedureGenerator = new StoredProcedureGenerator(this);
if (!(path.endsWith("\\") || path.endsWith("/"))) {
path = path + "\\";
}
String className = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf('.') + 1);
String packageName = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf('.'));
String fileName = path + className + ".java";
fileWriter = new java.io.FileWriter(fileName);
storedProcedureGenerator.generateStoredProcedures();
storedProcedureGenerator.generateAmendmentClass(fileWriter, packageName, className);
fileWriter.close();
} catch (java.io.IOException ioException) {
throw ValidationException.fileError(ioException);
} finally {
Helper.close(fileWriter);
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
jarOut.closeEntry();
} finally {
Helper.close(byteStream);
Helper.close(inStream);
Helper.close(jarOut);
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
SessionLog.WEAVER, e);
} finally {
Helper.close(fos);
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
SessionLog.WEAVER, e);
} finally {
Helper.close(fos);
内容来源于网络,如有侵权,请联系作者删除!