Sau một ByteBuffer được phân bổ, giá trị của nó được kiểm tra để xem liệu phân bổ bộ đệm tự động zero-nội dung và nó. Tất cả 1,024 giá trị được kiểm tra (lên đến giới hạn () của bộ đệm), và tất cả đều bằng không.
Cách dễ nhất để chèn các giá trị nguyên thủy vào một ByteBuffer là để có được những "view" thích hợp vào bộ đệm sử dụng asCharBuffer (), asShortBuffer ( ), vv, và sau đó để sử dụng phương pháp đặt điểm của (). Bạn có thể thấy điều này là quá trình sử dụng cho mỗi kiểu dữ liệu nguyên thủy. Là người duy nhất trong số này đó là một chút kỳ lạ là put () cho ShortBuffer, đòi hỏi một diễn viên (lưu ý cắt cụt đúc và thay đổi giá trị kết quả). Tất cả các view đệm khác không yêu cầu đúc trong đặt () của phương pháp.
đang được dịch, vui lòng đợi..