X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2Fssh%2Fvirtualsocket%2FChannelOutputStream.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2Fssh%2Fvirtualsocket%2FChannelOutputStream.java;h=0000000000000000000000000000000000000000;hp=cd7ec5439bc422e492b874b64e1be89211213d88;hb=c3108b4e80ec9f6ee6c8cf96df3009bb91dc8bc0;hpb=04a788d2df5303c60cdbcff02254291f411566bd diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelOutputStream.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelOutputStream.java deleted file mode 100644 index cd7ec5439b..0000000000 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelOutputStream.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.netconf.util.handler.ssh.virtualsocket; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.channel.ChannelPromise; - -import java.io.OutputStream; -import java.net.SocketAddress; - -/** - * Class provides {@link OutputStream) functionality to users of virtual socket. - */ -public class ChannelOutputStream extends OutputStream implements ChannelOutboundHandler { - private final Object lock = new Object(); - private ByteBuf buff = Unpooled.buffer(); - private ChannelHandlerContext ctx; - - @Override - public void flush() { - synchronized(lock) { - ctx.writeAndFlush(buff).awaitUninterruptibly(); - buff = Unpooled.buffer(); - } - } - - @Override - public void write(int b) { - synchronized(lock) { - buff.writeByte(b); - } - } - - public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, - ChannelPromise promise) { - ctx.bind(localAddress, promise); - } - - public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, - SocketAddress localAddress, ChannelPromise promise) { - this.ctx = ctx; - ctx.connect(remoteAddress, localAddress, promise); - } - - public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) { - ctx.disconnect(promise); - } - - public void close(ChannelHandlerContext ctx, ChannelPromise promise) { - ctx.close(promise); - } - - public void deregister(ChannelHandlerContext ctx, ChannelPromise channelPromise) { - ctx.deregister(channelPromise); - } - - public void read(ChannelHandlerContext ctx) { - ctx.read(); - } - - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { - // pass - } - - public void flush(ChannelHandlerContext ctx) { - // pass - } - - public void handlerAdded(ChannelHandlerContext ctx) - throws Exception { - } - - public void handlerRemoved(ChannelHandlerContext ctx) - throws Exception { - } - - public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - ctx.fireExceptionCaught(cause); - } -}