Java加载二进制文件 [英] Java loading binary files
问题描述
请告诉我最好/最快的方法:
Please show me the best/fast methods for:
1)将非常小的二进制文件加载到内存中。例如图标;
1) Loading very small binary files into memory. For example icons;
2)加载/读取大小为512Mb +的非常大的二进制文件。也许我必须使用内存映射IO?
2) Loading/reading very big binary files of size 512Mb+. Maybe i must use memory-mapped IO?
3)当你不想考虑大小/速度但是必须做的事情时你的共同选择:将所有字节读入记忆?
3) Your common choice when you do not want to think about size/speed but must do only thing: read all bytes into memory?
谢谢!!!
PS对不起,也许是微不足道的问题。请不要关闭它;)
P.S. Sorry for maybe trivial question. Please do not close it;)
P.S.2。 镜像 C#的模拟问题;
P.S.2. Mirror of analog question for C#;
推荐答案
对于内存映射文件,java有一个nio包:内存映射文件
For memory mapped files, java has a nio package: Memory Mapped Files
检查小文件的字节流类: Byte Stream
Check out byte stream class for small files:Byte Stream
查看更大文件的缓冲I / O:< a href =http://download.oracle.com/javase/tutorial/essential/io/buffers.html =nofollow>缓冲流
Check out buffered I/O for larger files: Buffered Stream
这篇关于Java加载二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!