Notice: Undefined index: HTTP_ACCEPT_ENCODING in C:\server\web\www.showyounger.com\s-system.php on line 2
创建指定大小的文件的代码 | 小样儿(ShowYounger)
小样儿,顶呱呱!!![http://www.showyounger.com]
- public static void main(String[] args) {
-
- MappedByteBuffer mbb;
- FileChannel fc;
- int length = 1 << 29;
-
- try {
- fc = new RandomAccessFile("/myfile.dat", "rw").getChannel();
- mbb = fc.map(FileChannel.MapMode.READ_WRITE, 0, length);
- } catch (FileNotFoundException e) {
-
- e.printStackTrace();
- } catch (IOException e) {
-
- e.printStackTrace();
- }
-
- }