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