本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt.loadBytes方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt.loadBytes方法的具体用法?Java FileUtilRt.loadBytes怎么用?Java FileUtilRt.loadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtilRt
的用法示例。
在下文中一共展示了FileUtilRt.loadBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Nullable
public static JarMemoryLoader load(ZipFile zipFile, URL baseUrl, Map<Resource.Attribute, String> attributes) throws IOException {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
if (!entries.hasMoreElements()) return null;
ZipEntry sizeEntry = entries.nextElement();
if (sizeEntry == null || !sizeEntry.getName().equals(SIZE_ENTRY)) return null;
byte[] bytes = FileUtilRt.loadBytes(zipFile.getInputStream(sizeEntry), 2);
int size = ((bytes[1] & 0xFF) << 8) + (bytes[0] & 0xFF);
JarMemoryLoader loader = new JarMemoryLoader();
for (int i = 0; i < size && entries.hasMoreElements(); i++) {
ZipEntry entry = entries.nextElement();
MemoryResource resource = MemoryResource.load(baseUrl, zipFile, entry, attributes);
loader.myResources.put(entry.getName(), resource);
}
return loader;
}
示例2: loadControls
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static Control[] loadControls() {
Document document;
try {
// use temporary bytes stream because otherwise inputStreamSkippingBOM will fail
// on ZipFileInputStream used in jar files
final InputStream stream = HTMLControls.class.getResourceAsStream("HtmlControls.xml");
final byte[] bytes = FileUtilRt.loadBytes(stream);
stream.close();
final UnsyncByteArrayInputStream bytesStream = new UnsyncByteArrayInputStream(bytes);
document = JDOMUtil.loadDocument(CharsetToolkit.inputStreamSkippingBOM(bytesStream));
bytesStream.close();
} catch (Exception e) {
LOG.error(e);
return new Control[0];
}
if (!document.getRootElement().getName().equals("htmlControls")) {
LOG.error("HTMLControls storage is broken");
return new Control[0];
}
return XmlSerializer.deserialize(document, Control[].class);
}
示例3: readFully
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static String readFully(InputStream inputStream) throws IOException {
return new String(FileUtilRt.loadBytes(inputStream));
}