本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil类的典型用法代码示例。如果您正苦于以下问题:Java NLSUtil类的具体用法?Java NLSUtil怎么用?Java NLSUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NLSUtil类属于org.eclipse.jdt.internal.corext.refactoring.nls包,在下文中一共展示了NLSUtil类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentContent
import org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil; //导入依赖的package包/类
public String getCurrentContent() throws JavaModelException {
IFile file = getOldFile(new NullProgressMonitor());
if (!file.exists()) return ""; // $NON-NLS-1$
InputStream stream = null;
try {
stream = file.getContents();
String encoding = file.getCharset();
String c = NLSUtil.readString(stream, encoding);
return (c == null) ? "" : c; // $NON-NLS-1$
} catch (CoreException e) {
throw new JavaModelException(e, IJavaModelStatusConstants.CORE_EXCEPTION);
} finally {
try {
if (stream != null) stream.close();
} catch (IOException x) {
}
}
}
示例2: getCurrentContent
import org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil; //导入依赖的package包/类
public String getCurrentContent() throws JavaModelException {
IFile file= getOldFile(new NullProgressMonitor());
if (! file.exists())
return ""; //$NON-NLS-1$
InputStream stream= null;
try{
stream= file.getContents();
String encoding= file.getCharset();
String c= NLSUtil.readString(stream, encoding);
return (c == null) ? "": c; //$NON-NLS-1$
} catch (CoreException e){
throw new JavaModelException(e, IJavaModelStatusConstants.CORE_EXCEPTION);
} finally {
try {
if (stream != null)
stream.close();
} catch (IOException x) {
}
}
}