Home | History | Annotate | Download | only in net

Lines Matching refs:length

69     int length;
76 * length {@code length}, specifying an offset into the buffer.
78 * The {@code length} argument must be less than or equal to
79 * {@code buf.length}.
83 * @param length the number of bytes to read.
87 public DatagramPacket(byte buf[], int offset, int length) {
88 setData(buf, offset, length);
95 * length {@code length}.
97 * The {@code length} argument must be less than or equal to
98 * {@code buf.length}.
101 * @param length the number of bytes to read.
103 public DatagramPacket(byte buf[], int length) {
104 this (buf, 0, length);
108 * Constructs a datagram packet for sending packets of length
109 * {@code length} with offset {@code ioffset}to the
111 * {@code length} argument must be less than or equal to
112 * {@code buf.length}.
116 * @param length the packet data length.
123 public DatagramPacket(byte buf[], int offset, int length,
125 setData(buf, offset, length);
132 * Constructs a datagram packet for sending packets of length
133 * {@code length} with offset {@code ioffset}to the
135 * {@code length} argument must be less than or equal to
136 * {@code buf.length}.
145 * @param length the packet data length.
152 public DatagramPacket(byte buf[], int offset, int length, SocketAddress address) {
153 setData(buf, offset, length);
159 * Constructs a datagram packet for sending packets of length
160 * {@code length} to the specified port number on the specified
161 * host. The {@code length} argument must be less than or equal
162 * to {@code buf.length}.
170 * @param length the packet length.
175 public DatagramPacket(byte buf[], int length,
177 this(buf, 0, length, address, port);
181 * Constructs a datagram packet for sending packets of length
182 * {@code length} to the specified port number on the specified
183 * host. The {@code length} argument must be less than or equal
184 * to {@code buf.length}.
187 * @param length the packet length.
193 public DatagramPacket(byte buf[], int length, SocketAddress address) {
194 this(buf, 0, length, address);
225 * and runs for {@code length} long.
248 * Returns the length of the data to be sent or the length of the
251 * @return the length of the data to be sent or the length of the
256 return length;
261 * data, length and offset of the packet.
267 * @param length the length of the data
268 * and/or the length of the buffer used to receive data
278 public synchronized void setData(byte[] buf, int offset, int length) {
280 if (length < 0 || offset < 0 ||
281 (length + offset) < 0 ||
282 ((length + offset) > buf.length)) {
283 throw new IllegalArgumentException("illegal length or offset");
286 this.length = length;
287 this.bufLength = length;
304 * Sets 'length' without changing 'userSuppliedLength', after receiving a packet.
307 public void setReceivedLength(int length) {
308 this.length = length;
361 * this DatagramPacket set to 0, and the length set to
362 * the length of {@code buf}.
379 this.length = buf.length;
380 this.bufLength = buf.length;
384 * Set the length for this packet. The length of the packet is
387 * will be used for receiving data. The length must be lesser or
388 * equal to the offset plus the length of the packet's buffer.
390 * @param length the length to set for this packet.
392 * @exception IllegalArgumentException if the length is negative
393 * of if the length is greater than the packet's data buffer
394 * length.
401 public synchronized void setLength(int length) {
402 if ((length + offset) > buf.length || length < 0 ||
403 (length + offset) < 0) {
404 throw new IllegalArgumentException("illegal length");
406 this.length = length;
407 this.bufLength = this.length;