Package java.nio.channels

Examples of java.nio.channels.FileChannel.force()


                }

                tableBuilder.finish();
            } finally {
                try {
                    channel.force(true);
                } finally {
                    channel.close();
                }
            }
View Full Code Here


      @Override
      public void flush(File f) throws IOException {
         FileChannel channel = streams.get(f.getPath());
         if (channel != null)
            channel.force(false);
      }

      @Override
      public void purge(File f) throws IOException {
         // Avoid a delete per-se because it hampers any fsync-like functionality
View Full Code Here

               for (Map.Entry<String, FileChannel> entry : streams.entrySet()) {
                  if (trace)
                     log.tracef("Flushing channel in %s", entry.getKey());
                  FileChannel channel = entry.getValue();
                  try {
                     channel.force(true);
                  } catch (IOException e) {
                     if (trace)
                        log.tracef(e, "Error flushing output stream for %s", entry.getKey());
                     flushErrors.putIfAbsent(entry.getKey(), e);
                     // If an error is encountered, close it. Next time it's used,
View Full Code Here

      if (fsync) {
        FileChannel fc = os.getChannel();
        ByteBuffer buf = ByteBuffer.wrap(content);
        while (0 < buf.remaining())
          fc.write(buf);
        fc.force(true);
      } else {
        os.write(content);
      }
      os.close();
      os = null;
View Full Code Here

        if (wc.getFSyncRefFiles()) {
          FileChannel fc = out.getChannel();
          ByteBuffer buf = ByteBuffer.wrap(rec);
          while (0 < buf.remaining())
            fc.write(buf);
          fc.force(true);
        } else {
          out.write(rec);
        }
      } finally {
        out.close();
View Full Code Here

      if (fsync) {
        FileChannel fc = os.getChannel();
        ByteBuffer buf = ByteBuffer.wrap(content);
        while (0 < buf.remaining())
          fc.write(buf);
        fc.force(true);
      } else {
        os.write(content);
      }
      os.close();
      os = null;
View Full Code Here

        if (wc.getFSyncRefFiles()) {
          FileChannel fc = out.getChannel();
          ByteBuffer buf = ByteBuffer.wrap(rec);
          while (0 < buf.remaining())
            fc.write(buf);
          fc.force(true);
        } else {
          out.write(rec);
        }
      } finally {
        out.close();
View Full Code Here

      @Override
      public void flush(File f) throws IOException {
         FileChannel channel = streams.get(f.getPath());
         if (channel != null)
            channel.force(false);
      }

      @Override
      public void purge(File f) throws IOException {
         // Avoid a delete per-se because it hampers any fsync-like functionality
View Full Code Here

               for (Map.Entry<String, FileChannel> entry : streams.entrySet()) {
                  if (trace)
                     log.tracef("Flushing channel in %s", entry.getKey());
                  FileChannel channel = entry.getValue();
                  try {
                     channel.force(true);
                  } catch (IOException e) {
                     if (trace)
                        log.tracef(e, "Error flushing output stream for %s", entry.getKey());
                     flushErrors.putIfAbsent(entry.getKey(), e);
                     // If an error is encountered, close it. Next time it's used,
View Full Code Here

        file.delete();
        RandomAccessFile ra = new RandomAccessFile(file, "rw");
        FileUtils.delete(s);
        FileChannel f = FileUtils.open(s, "rw");
        assertEquals(-1, f.read(ByteBuffer.wrap(new byte[1])));
        f.force(true);
        Random random = new Random(seed);
        int size = 500;
        try {
            for (int i = 0; i < size; i++) {
                trace("op " + i);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.