Grabs the channel for writing.

@param channel the channel

@return true if the channel has permission to write.
489641
OutputStream writeChannel(int channel)
        throws IOException
    {
        while (os != null) {
            boolean canWrite = false;
            synchronized (WRITE_LOCK) {
                if (!isWriteLocked) {
                    isWriteLocked = true;
                    canWrite = true;
                }
                else {
                    try {
                        WRITE_LOCK.wait(5000);
                    } catch (Exception e) {
                    }
                }
            }

            if (canWrite) {
                os.write('C');
                os.write(channel >> 8);
                os.write(channel);

                return os;
            }
        }

        return null;
    }
1221866
public int write(WritableByteChannel channel) throws IOException {
        // header
        ByteBuffer header = ByteBuffer.allocate(HEADER_LENGTH);
        header.putInt(getSegmentId());
        header.putLong(getSegmentLastForcedTime());
        header.putInt(size());
        
        // footer
        ByteBuffer footer;
        try {
            MessageDigest m = MessageDigest.getInstance("MD5");
            m.reset();
            m.update(header.array());
            m.update(_buffer.array(), 0, _buffer.position());
            byte[] digest = ensure128BitMD5(m.digest());
            
            footer = ByteBuffer.allocate(MD5_LENGTH);
            footer.put(digest);
        } catch (NoSuchAlgorithmException e) {
            throw new IOException(e);
        }
        
        // Write header, data, footer
        header.flip();
        channel.write(header);
        
        channel.write(ByteBuffer.wrap(_buffer.array(), 0, _buffer.position()));
        
        footer.flip();
        channel.write(footer);
        
        return (_buffer.position() + HEADER_FOOTER_LENGTH);
    }
37229
public function has_channel( $channel ) {

		if ( ! is_string( $channel ) ) {
			throw InvalidChannelNameException::for_invalid_type( $channel );
		}

		return in_array( $channel, $this->channels );
	}
6256
@Override
	public boolean write(Writer writer) throws IOException {

		writeBlock(writer, EmblPadding.PA_PADDING, accession);

		return true;
	}
1292339
public ChannelFuture removeAndWrite() {
        assert ctx.executor().inEventLoop();
        PendingWrite write = head;
        if (write == null) {
            return null;
        }
        Object msg = write.msg;
        ChannelPromise promise = write.promise;
        recycle(write, true);
        return ctx.write(msg, promise);
    }
560797
public void addChannelToCache(Channel channel) {
        Channel oldChannel = channels.put(channel.getId(), channel);
        if (oldChannel != channel && oldChannel instanceof Cleanupable) {
            ((Cleanupable) oldChannel).cleanup();
        }
    }
574024
public function hasChannel($channel)
    {
        if ($channel instanceof ChannelInterface) {
            $channel = $channel->getId();
        }

        $channel = (string) $channel;

        return false === array_search($channel, $this->channels) ? false : true;
    }
775301
@Override
    public synchronized ChannelData getChannel(String channelName) {
        ChannelData channel = null;
        if (null != channelName) {
            channel = this.channelDataMap.get(channelName);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getChannel: " + channelName + " found=" + (null != channel));
        }
        return channel;
    }
103797
public void write(WritableByteChannel channel) throws IOException {
        logger.debug("Writing> {}", this);
        for (Field field : fields) {
            field.write(channel);
        }
    }
522048
public static int read(ReadableByteChannel channel, ByteBuffer buffer) throws IOException {
        int count = channel.read(buffer);
        if (count == -1) throw new EOFException("Received -1 when reading from channel, socket has likely been closed.");
        return count;
    }
1312181
public void init(Channel channel, long writtenAmount) {
        if (channel == null) {
            throw new NullPointerException("channel");
        }
        if (writtenAmount <= 0) {
            throw new IllegalArgumentException(
                    "writtenAmount must be a positive integer: " + writtenAmount);
        }

        this.channel = channel;
        this.writtenAmount = writtenAmount;
    }
97359
public void writeTo(WritableByteChannel channel) throws IOException {
        for (ByteBuffer buffer : toDirectByteBuffers()) {
            channel.write(buffer);
        }
    }
507954
private synchronized void createChannel(String channel) {
        if (!channelExists(channel)) {
            Queue queue = new Queue(channel, true, false, true);
            admin.declareQueue(queue);
            Binding binding = new Binding(channel, DestinationType.QUEUE, exchange.getName(), channel + ".#", null);
            admin.declareBinding(binding);
        }
    }
1317628
def Write(
        self,
        Channel,
        MessageBuffer):

        
        try:
            res = self.__m_dllBasic.CAN_Write(Channel,byref(MessageBuffer))
            return TPCANStatus(res)
        except:
            logger.error("Exception on PCANBasic.Write")
            raise
1021719
private void handleGroupChannel(JsonNode channel) {
        long channelId = channel.get("id").asLong();
        if (!api.getGroupChannelById(channelId).isPresent()) {
            GroupChannel groupChannel = new GroupChannelImpl(api, channel);
            GroupChannelCreateEvent event = new GroupChannelCreateEventImpl(groupChannel);

            api.getEventDispatcher().dispatchGroupChannelCreateEvent(api, groupChannel.getMembers(), event);
        }
    }
832237
public void styleChannel(String channel, Style style){
    if(this.channelStyles == null){
      this.channelStyles = new HashMap<String,Style>();
    }
    this.channelStyles.put(channel.toLowerCase(),style);
  }
252517
public void unsubscribe(String channel) {
		ChannelSubscription subscribedChannel = subscribedChannels.get(channel);

		if (isUnsubscribeValid(channel, subscribedChannel)) {
			subscribedChannel.setSubscribeOnReconnected(false);
			unsubscribe(channel, true, subscribedChannel.isWithNotification());
		}

		//subscribedChannels.remove(channel);
	}