Code example for ByteChannel

Methods: close

0
				if(bytesWritten != -1)
					totalBytesWritten += bytesWritten;
				 
			} else { 
				log.error("Closing session " + getSessionID() + " with " + writeBuffer.position() + " bytes remaining from " + getSourceType());
				senderChannel.close();
			} 
 
			if(log.isDebugEnabled()) 
				log.debug("Transferred " + bytesWritten + " bytes from " + getSourceType() + " on session " + getSessionID());
 
			return bytesWritten;
		} 
		 
		return 0; 
	} 
 
	protected byte[] processBytesRead(ByteBuffer buffer, int start) throws IOException {
		int end = buffer.position();
		byte[] transferBuffer = new byte[end - start];