Skip to content

Package: FileChunk

FileChunk

Coverage

1: /*
2: * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved.
3: * Copyright (c) 2018 Payara Services Ltd.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package org.glassfish.grizzly;
19:
20: import java.io.IOException;
21: import java.nio.channels.WritableByteChannel;
22: import org.glassfish.grizzly.asyncqueue.WritableMessage;
23:
24: public interface FileChunk extends WritableMessage {
25:
26: /**
27: * Transfers the File region backing this <code>FileRegion</code> to the specified {@link WritableByteChannel}.
28: *
29: * @param c the {@link WritableByteChannel}
30: * @return the number of bytes that have been transferred
31: * @throws IOException if an error occurs while processing
32: * @see java.nio.channels.FileChannel#transferTo(long, long, java.nio.channels.WritableByteChannel)
33: */
34: long writeTo(final WritableByteChannel c) throws IOException;
35:
36: }