Class ByteBufferUtils

java.lang.Object
org.jdrupes.httpcodec.util.ByteBufferUtils

public class ByteBufferUtils extends Object
Utilities for handling ByteBuffers
  • Method Details

    • putAsMuchAsPossible

      public static boolean putAsMuchAsPossible(ByteBuffer dest, ByteBuffer src)
      Put as many bytes as possible from the src buffer into the destination buffer.
      Parameters:
      dest - the destination buffer
      src - the source buffer
      Returns:
      true if src.remaining() == 0
    • putAsMuchAsPossible

      public static boolean putAsMuchAsPossible(ByteBuffer dest, ByteBuffer src, int limit)
      Put as many bytes as possible from the src buffer into the destination buffer but not more than specified by limit.
      Parameters:
      dest - the destination buffer
      src - the source buffer
      limit - the maximum number of bytes to transfer
      Returns:
      true if src.remaining() == 0