集册 Java实例教程 强制将文件更新到磁盘

强制将文件更新到磁盘

欢马劈雪     最近更新时间:2020-01-02 10:19:05

645
强制将文件更新更新到磁盘
//n o w  j a v a  . c o m 提 供

import java.io.FileDescriptor;

import java.io.FileOutputStream;

import java.io.IOException;


public class Main {


  public static void main(String[] argv) {

    try {

      // Open or create the output file

      FileOutputStream os = new FileOutputStream("outfilename");

      FileDescriptor fd = os.getFD();


      // Write some data to the stream

      byte[] data = new byte[] { (byte) 0xCA, (byte) 0xFE, (byte) 0xBA,

          (
展开阅读全文