Examples of compact()


Examples of java.nio.ByteBuffer.compact()

               
             if (read > 0) {
                int size = outChannel.write(copyBuffer);
                written.addAndGet(size);
                if (copyBuffer.hasRemaining()) {
                   copyBuffer.compact();
                } else {
                   copyBuffer.clear();
                }
             }
          }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

               
             if (read > 0) {
                int size = outChannel.write(copyBuffer);
                written.addAndGet(size);
                if (copyBuffer.hasRemaining()) {
                   copyBuffer.compact();
                } else {
                   copyBuffer.clear();
                }
             }
          }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

               
             if (read > 0) {
                int size = outChannel.write(copyBuffer);
                written.addAndGet(size);
                if (copyBuffer.hasRemaining()) {
                   copyBuffer.compact();
                } else {
                   copyBuffer.clear();
                }
             }
          }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

               
             if (read > 0) {
                int size = outChannel.write(copyBuffer);
                written.addAndGet(size);
                if (copyBuffer.hasRemaining()) {
                   copyBuffer.compact();
                } else {
                   copyBuffer.clear();
                }
             }
          }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

      if (! Arrays.equals(magic, METABLOCKMAGIC)) {
        throw new IOException("Meta magic is bad in block " + block);
      }
      // Toss the header. May have to remove later due to performance.
      buf.compact();
      buf.limit(buf.limit() - METABLOCKMAGIC.length);
      buf.rewind();
      return buf;
    }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

        buf.get(magic, 0, magic.length);
        if (!Arrays.equals(magic, DATABLOCKMAGIC)) {
          throw new IOException("Data magic is bad in block " + block);
        }
        // Toss the header. May have to remove later due to performance.
        buf.compact();
        buf.limit(buf.limit() - DATABLOCKMAGIC.length);
        buf.rewind();

        readTime += System.currentTimeMillis() - now;
        readOps++;
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

                        assertEquals(msg + ": Compare byte " + (checked + index), b1, b2);
                    }
                }
                checked += nRead1;
                bFile.compact();
                bIn.compact();
            }
            assertEquals(msg + ": Compared all bytes", size, checked);
            assertEquals(msg + ": InputStream must be at EOF", -1, inChannel.read(bIn));
        }
    }
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

                    long took = System.nanoTime() - next;
                    if (i >= WARMUP)
                        histo.sample(took);
                    else
                        warmup.sample(took);
                    time.compact();
                }

                StringBuilder heading = new StringBuilder("runs\trate\twarmup\tbusy");
                StringBuilder values = new StringBuilder(RUNS + "\t" + RATE + "\t" + WARMUP + "\t" + BUSY);
                for (double perc : new double[]{50, 90, 99, 99.9, 99.99, 99.999}) {
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

        fb.clear();
      }
      while (is.read(fb) != -1 && check.sameSoFar()) {
        fb.flip();
        filters.write(fb);
        fb.compact();
      }
      return check.ultimatelyTheSame();
    } catch (CancelledException ex) {
      repo.getSessionContext().getLog().dump(getClass(), Warn, ex, "Unexpected cancellation");
      return check.ultimatelyTheSame();
View Full Code Here

Examples of java.nio.ByteBuffer.compact()

          buffer.flip();
          // write to the channel, may block
          outChannel.write(buffer);
          // If partial transfer, shift remainder down
          // If buffer is empty, same as doing clear()
          buffer.compact();
        }
        // EOF will leave buffer in fill state
        buffer.flip();
        // make sure the buffer is fully drained.
        while (buffer.hasRemaining()) {
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.