Package java.nio.channels

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


      FileChannel channel = fos.getChannel();
      OutputStream channelStream = Channels.newOutputStream(channel);
      try {
        pw.writePack(pm, pm, channelStream);
      } finally {
        channel.force(true);
        channelStream.close();
        fos.close();
      }

      // write the packindex
View Full Code Here


      FileChannel idxChannel = fos.getChannel();
      OutputStream idxStream = Channels.newOutputStream(idxChannel);
      try {
        pw.writeIndex(idxStream);
      } finally {
        idxChannel.force(true);
        idxStream.close();
        fos.close();
      }

      if (pw.prepareBitmapIndex(pm)) {
View Full Code Here

        idxChannel = fos.getChannel();
        idxStream = Channels.newOutputStream(idxChannel);
        try {
          pw.writeBitmapIndex(idxStream);
        } finally {
          idxChannel.force(true);
          idxStream.close();
          fos.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

        int written = 0;
        while (written < size) {
            written += localfileChannel.write(byteBuffer);
        }
        buffer.readerIndex(buffer.readerIndex() + written);
        localfileChannel.force(false);
        localfileChannel.close();
        outputStream.close();
        completed = true;
    }
View Full Code Here

        while (read > 0) {
            byteBuffer.position(read).flip();
            written += localfileChannel.write(byteBuffer);
            read = inputStream.read(bytes);
        }
        localfileChannel.force(false);
        localfileChannel.close();
        size = written;
        if (definedSize > 0 && definedSize < size) {
            file.delete();
            file = null;
View Full Code Here

        ByteBuffer byteBuffer = byteBuf.nioBuffer();
        int written = 0;
        while (written < length) {
            written += fileChannel.write(byteBuffer);
        }
        fileChannel.force(false);
        fileChannel.close();
        outputStream.close();
        isRenamed = true;
        return written == length;
    }
View Full Code Here

         ByteBuffer bb = generateBuffer(fileSize, (byte)'x');

         write(bb, channel, fileSize);

         channel.force(true);

         channel.position(0);

         ByteBuffer bb1 = generateBuffer(recordSize, (byte)'h');
View Full Code Here

               start = System.currentTimeMillis();
            }

            bb1.flip();
            channel.write(bb1);
            channel.force(false);
         }

         long end = System.currentTimeMillis();

         double rate = 1000 * (double)its / (end - start);
View Full Code Here

        long address = Long.MAX_VALUE;
        try {
            address = flush();
            if (address != Long.MAX_VALUE) {
                final FileChannel channel = getFileChannel(address);
                channel.force(false);
            }
        } catch (final IOException e) {
            throw new PersistitIOException("Writing to file " + addressToFile(address), e);
        }
    }
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.