Codota Logo
java.nio
Code IndexAdd Codota to your IDE (free)

How to use java.nio

Best Java code snippets using java.nio (Showing top 20 results out of 60,255)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

private void write(ByteBuffer source) {
  int length = source.remaining();
  ByteBuffer tmp = this.byteBuffer.duplicate();
  int limit = this.writePosition + source.remaining();
  ((Buffer) tmp).clear().position(this.writePosition).limit(limit);
  tmp.put(source);
  this.writePosition += length;
}
origin: apache/incubator-dubbo

@Override
public void setBytes(int index, byte[] src, int srcIndex, int length) {
  ByteBuffer data = buffer.duplicate();
  data.limit(index + length).position(index);
  data.put(src, srcIndex, length);
}
origin: google/guava

@Override
protected void processRemaining(ByteBuffer buffer) {
 b += buffer.remaining();
 for (int i = 0; buffer.hasRemaining(); i += 8) {
  finalM ^= (buffer.get() & 0xFFL) << i;
 }
}
origin: google/guava

/**
 * Flips the buffer output buffer so we can start reading bytes from it. If we are starting to
 * drain because there was overflow, and there aren't actually any characters to drain, then the
 * overflow must be due to a small output buffer.
 */
private void startDraining(boolean overflow) {
 byteBuffer.flip();
 if (overflow && byteBuffer.remaining() == 0) {
  byteBuffer = ByteBuffer.allocate(byteBuffer.capacity() * 2);
 } else {
  draining = true;
 }
}
origin: apache/incubator-dubbo

@Override
public void getBytes(int index, byte[] dst, int dstIndex, int length) {
  ByteBuffer data = buffer.duplicate();
  try {
    data.limit(index + length).position(index);
  } catch (IllegalArgumentException e) {
    throw new IndexOutOfBoundsException();
  }
  data.get(dst, dstIndex, length);
}
origin: spring-projects/spring-framework

/**
 * Create a new binary WebSocket message by wrapping an existing byte array.
 * @param payload a non-null payload; note that this value is not copied so care
 * must be taken not to modify the array.
 * @param offset the offset into the array where the payload starts
 * @param length the length of the array considered for the payload
 * @param isLast if the message is the last of a series of partial messages
 */
public BinaryMessage(byte[] payload, int offset, int length, boolean isLast) {
  super(ByteBuffer.wrap(payload, offset, length), isLast);
}
origin: google/guava

 @Override
 protected void process(ByteBuffer bb) {
  while (bb.hasRemaining()) {
   bb.get();
  }
 }
};
origin: spring-projects/spring-framework

/**
 * Create a new ping message with an empty payload.
 */
public PingMessage() {
  super(ByteBuffer.allocate(0));
}
origin: spring-projects/spring-framework

/**
 * Calculate the current buffer size.
 */
public int getBufferSize() {
  int size = 0;
  for (ByteBuffer buffer : this.chunks) {
    size = size + buffer.remaining();
  }
  return size;
}
origin: spring-projects/spring-framework

@Override
public ByteBuffer asByteBuffer(int index, int length) {
  checkIndex(index, length);
  ByteBuffer duplicate = this.byteBuffer.duplicate();
  // Explicit access via Buffer base type for compatibility
  // with covariant return type on JDK 9's ByteBuffer...
  Buffer buffer = duplicate;
  buffer.position(index);
  buffer.limit(index + length);
  return duplicate.slice();
}
origin: apache/incubator-dubbo

  @Override
  public int arrayOffset() {
    return buffer.arrayOffset();
  }
}
origin: google/guava

/** Creates a new {@code CharBuffer} for buffering reads or writes. */
static CharBuffer createBuffer() {
 return CharBuffer.allocate(DEFAULT_BUF_SIZE);
}
origin: google/guava

/** Returns the number of elements between the limit and capacity. */
private static int availableCapacity(Buffer buffer) {
 return buffer.capacity() - buffer.limit();
}
origin: apache/incubator-dubbo

@Override
public void setBytes(int index, byte[] src, int srcIndex, int length) {
  ByteBuffer data = buffer.duplicate();
  data.limit(index + length).position(index);
  data.put(src, srcIndex, length);
}
origin: apache/incubator-dubbo

  @Override
  public ByteBuffer toByteBuffer(int index, int length) {
    return ByteBuffer.wrap(array, index, length);
  }
}
origin: spring-projects/spring-framework

/**
 * Create a new pong message with an empty payload.
 */
public PongMessage() {
  super(ByteBuffer.allocate(0));
}
origin: apache/incubator-dubbo

  @Override
  public int arrayOffset() {
    return buffer.arrayOffset();
  }
}
origin: apache/incubator-dubbo

@Override
public void setBytes(int index, ByteBuffer src) {
  ByteBuffer data = buffer.duplicate();
  data.limit(index + src.remaining()).position(index);
  data.put(src);
}
origin: apache/incubator-dubbo

  @Override
  public ByteBuffer toByteBuffer(int index, int length) {
    return ByteBuffer.wrap(array, index, length);
  }
}
origin: apache/incubator-dubbo

@Override
public void setBytes(int index, ByteBuffer src) {
  ByteBuffer data = buffer.duplicate();
  data.limit(index + src.remaining()).position(index);
  data.put(src);
}
java.nio

Most used classes

  • Charset
  • ByteBuffer
  • Files
  • Path
  • Paths
  • CharBuffer,
  • FileSystem,
  • FileSystems,
  • Channels,
  • CharsetEncoder,
  • SocketChannel,
  • CharsetDecoder,
  • IntBuffer,
  • ByteOrder,
  • FloatBuffer,
  • ReadableByteChannel,
  • Selector,
  • WritableByteChannel,
  • SelectionKey
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now