comparison src/org/tmatesoft/hg/util/ByteChannel.java @ 115:c0cc2535462c

Introduced channels to pipeline (and easily filter) data streams
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 03 Feb 2011 23:32:08 +0100
parents
children 7567f4a42fe5
comparison
equal deleted inserted replaced
114:46291ec605a0 115:c0cc2535462c
1 /*
2 * Copyright (c) 2011 TMate Software Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@svnkit.com
16 */
17 package org.tmatesoft.hg.util;
18
19 import java.nio.ByteBuffer;
20
21 /**
22 * Much like {@link java.nio.channels.WritableByteChannel} except for thrown exception
23 *
24 * XXX Perhaps, we'll add CharChannel in the future to deal with character conversions/encodings
25 *
26 * @author Artem Tikhomirov
27 * @author TMate Software Ltd.
28 */
29 public interface ByteChannel {
30 // XXX does int return value makes any sense given buffer keeps its read state
31 // not clear what retvalue should be in case some filtering happened inside write - i.e. return
32 // number of bytes consumed in
33 int write(ByteBuffer buffer) throws Exception /*FIXME Exception type*/;
34 }