1 /*
2 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
90 * larger than {@code dsts.length}
91 *
92 * @param length
93 * The maximum number of buffers to be accessed; must be
94 * non-negative and no larger than
95 * {@code dsts.length} - {@code offset}
96 *
97 * @return The number of bytes read, possibly zero,
98 * or {@code -1} if the channel has reached end-of-stream
99 *
100 * @throws IndexOutOfBoundsException
101 * If the preconditions on the {@code offset} and {@code length}
102 * parameters do not hold
103 *
104 * @throws NonReadableChannelException
105 * If this channel was not opened for reading
106 *
107 * @throws ClosedChannelException
108 * If this channel is closed
109 *
110 * @throws AsynchronousCloseException
111 * If another thread closes this channel
112 * while the read operation is in progress
113 *
114 * @throws ClosedByInterruptException
115 * If another thread interrupts the current thread
116 * while the read operation is in progress, thereby
117 * closing the channel and setting the current thread's
118 * interrupt status
119 *
120 * @throws IOException
121 * If some other I/O error occurs
122 */
123 public long read(ByteBuffer[] dsts, int offset, int length)
124 throws IOException;
125
126 /**
127 * Reads a sequence of bytes from this channel into the given buffers.
128 *
129 * <p> An invocation of this method of the form {@code c.read(dsts)}
130 * behaves in exactly the same manner as the invocation
131 *
132 * <blockquote><pre>
133 * c.read(dsts, 0, dsts.length);</pre></blockquote>
134 *
135 * @param dsts
136 * The buffers into which bytes are to be transferred
137 *
138 * @return The number of bytes read, possibly zero,
139 * or {@code -1} if the channel has reached end-of-stream
140 *
141 * @throws NonReadableChannelException
142 * If this channel was not opened for reading
143 *
144 * @throws ClosedChannelException
145 * If this channel is closed
146 *
147 * @throws AsynchronousCloseException
148 * If another thread closes this channel
149 * while the read operation is in progress
150 *
151 * @throws ClosedByInterruptException
152 * If another thread interrupts the current thread
153 * while the read operation is in progress, thereby
154 * closing the channel and setting the current thread's
155 * interrupt status
156 *
157 * @throws IOException
158 * If some other I/O error occurs
159 */
160 public long read(ByteBuffer[] dsts) throws IOException;
161
162 }
|
1 /*
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
90 * larger than {@code dsts.length}
91 *
92 * @param length
93 * The maximum number of buffers to be accessed; must be
94 * non-negative and no larger than
95 * {@code dsts.length} - {@code offset}
96 *
97 * @return The number of bytes read, possibly zero,
98 * or {@code -1} if the channel has reached end-of-stream
99 *
100 * @throws IndexOutOfBoundsException
101 * If the preconditions on the {@code offset} and {@code length}
102 * parameters do not hold
103 *
104 * @throws NonReadableChannelException
105 * If this channel was not opened for reading
106 *
107 * @throws ClosedChannelException
108 * If this channel is closed
109 *
110 * @throws IllegalArgumentException
111 * If any of the buffers is read-only
112 *
113 * @throws AsynchronousCloseException
114 * If another thread closes this channel
115 * while the read operation is in progress
116 *
117 * @throws ClosedByInterruptException
118 * If another thread interrupts the current thread
119 * while the read operation is in progress, thereby
120 * closing the channel and setting the current thread's
121 * interrupt status
122 *
123 * @throws IOException
124 * If some other I/O error occurs
125 */
126 public long read(ByteBuffer[] dsts, int offset, int length)
127 throws IOException;
128
129 /**
130 * Reads a sequence of bytes from this channel into the given buffers.
131 *
132 * <p> An invocation of this method of the form {@code c.read(dsts)}
133 * behaves in exactly the same manner as the invocation
134 *
135 * <blockquote><pre>
136 * c.read(dsts, 0, dsts.length);</pre></blockquote>
137 *
138 * @param dsts
139 * The buffers into which bytes are to be transferred
140 *
141 * @return The number of bytes read, possibly zero,
142 * or {@code -1} if the channel has reached end-of-stream
143 *
144 * @throws NonReadableChannelException
145 * If this channel was not opened for reading
146 *
147 * @throws ClosedChannelException
148 * If this channel is closed
149 *
150 * @throws IllegalArgumentException
151 * If any of the buffers is read-only
152 *
153 * @throws AsynchronousCloseException
154 * If another thread closes this channel
155 * while the read operation is in progress
156 *
157 * @throws ClosedByInterruptException
158 * If another thread interrupts the current thread
159 * while the read operation is in progress, thereby
160 * closing the channel and setting the current thread's
161 * interrupt status
162 *
163 * @throws IOException
164 * If some other I/O error occurs
165 */
166 public long read(ByteBuffer[] dsts) throws IOException;
167
168 }
|