kitaev@213: /* kitaev@213: * Copyright (c) 2011 TMate Software Ltd kitaev@213: * kitaev@213: * This program is free software; you can redistribute it and/or modify kitaev@213: * it under the terms of the GNU General Public License as published by kitaev@213: * the Free Software Foundation; version 2 of the License. kitaev@213: * kitaev@213: * This program is distributed in the hope that it will be useful, kitaev@213: * but WITHOUT ANY WARRANTY; without even the implied warranty of kitaev@213: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the kitaev@213: * GNU General Public License for more details. kitaev@213: * kitaev@213: * For information on how to redistribute this software under kitaev@213: * the terms of a license other than GNU General Public License kitaev@213: * contact TMate Software at support@hg4j.com kitaev@213: */ kitaev@213: package org.tmatesoft.hg.util; kitaev@213: kitaev@213: import java.io.IOException; kitaev@213: import java.nio.ByteBuffer; kitaev@213: kitaev@213: /** kitaev@213: * Much like {@link java.nio.channels.WritableByteChannel} except for thrown exception kitaev@213: * kitaev@213: * XXX Perhaps, we'll add CharChannel in the future to deal with character conversions/encodings kitaev@213: * kitaev@213: * @author Artem Tikhomirov kitaev@213: * @author TMate Software Ltd. kitaev@213: */ kitaev@213: public interface ByteChannel { kitaev@213: // XXX does int return value makes any sense given buffer keeps its read state kitaev@213: // not clear what retvalue should be in case some filtering happened inside write - i.e. return kitaev@213: // number of bytes consumed in kitaev@213: int write(ByteBuffer buffer) throws IOException, CancelledException; kitaev@213: }