Package java.nio

Examples of java.nio.MappedByteBuffer.force()


  public synchronized void flush() {
    final ByteBuffer buffer = getIfCached();
    if (buffer != null) {
      if (buffer instanceof MappedByteBuffer) {
        final MappedByteBuffer mappedByteBuffer = (MappedByteBuffer)buffer;
        mappedByteBuffer.force();
      }
    }
  }

  public synchronized void dispose() {
View Full Code Here


                        buffer.putFloat(p.x);
                        buffer.putFloat(p.y);
                        buffer.putFloat(p.z);
                    }
                }
                buffer.force();
                channel.close();
                file.close();
                logger.info("written " + parts.size() + " particles to "
                        + fname);
            } catch (Exception e) {
View Full Code Here

               chf = File.createTempFile("jcrvdedit", null, tempDirectory);
               chch = new RandomAccessFile(chf, "rw").getChannel();

               // allocate the space for whole file
               MappedByteBuffer bb = chch.map(FileChannel.MapMode.READ_WRITE, position + length, 0);
               bb.force();
               bb = null;

               ReadableByteChannel bch = Channels.newChannel(new ByteArrayInputStream(this.data));

               if ((newIndex = (int)position) > 0)
View Full Code Here

         ReadableByteChannel ch = Channels.newChannel(stream);
         ch.read(bb);
         ch.close();

         bb.force();
      }
   }

   /**
    * Set length of the Value in bytes to the specified <code>size</code>.
View Full Code Here

               if (chch.size() < size)
               {
                  // extend length
                  MappedByteBuffer bb = chch.map(FileChannel.MapMode.READ_WRITE, size, 0);
                  bb.force();
               }
            }
            catch (final IOException e)
            {
               try
View Full Code Here

      {
         if (spoolChannel.size() < size)
         {
            // extend file
            MappedByteBuffer bb = spoolChannel.map(FileChannel.MapMode.READ_WRITE, size, 0);
            bb.force();
         }
         else
         {
            // truncate file
            spoolChannel.truncate(size);
View Full Code Here

            growLock.lock();
            try{
                for(ByteBuffer b: slices){
                    if(b!=null && (b instanceof MappedByteBuffer)){
                        MappedByteBuffer bb = ((MappedByteBuffer) b);
                        bb.force();
                    }
                }

            }finally{
                growLock.unlock();
View Full Code Here

                    buf.putShort((short) 0);
                    buf.putFloat(0F);
                }
            }

            buf.force();
            CloserUtil.close(channel);
            CloserUtil.close(raf);
        } catch (final IOException e) {
            throw new PicardException("IOException writing tileMetricsOut file (" + tileMetricsOut + ")", e);
        }
View Full Code Here

  private void resizeNio(RandomAccessFile file) throws IOException {
    FileChannel channel = file.getChannel();
    MappedByteBuffer buffer = channel.map(MapMode.READ_WRITE, 24L, 4L);
    buffer.put(this.getDimensionMask());
    buffer.force();
  }


  /**
   * {@inheritDoc}
 
View Full Code Here

    RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
    try {
      FileChannel channel = randomAccessFile.getChannel();
      MappedByteBuffer buffer = channel.map(MapMode.READ_WRITE, 24L, 4L);
      buffer.put(this.getDimensionMask());
      buffer.force();
    } finally {
      randomAccessFile.close();
    }
    return true;
  }
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.