code: protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception {
          // The outbound buffer contains only one message or it contains a file region.
          Object msg = in.current();
          if (msg instanceof ByteBuf) {
              return writeBytes(in, (ByteBuf) msg);
          } else if (msg instanceof DefaultFileRegion) {
              return writeDefaultFileRegion(in, (DefaultFileRegion) msg);
          } else if (msg instanceof FileRegion) {
              return writeFileRegion(in, (FileRegion) msg);
          } else {
              // Should never reach here.
              throw new Error();
          }
      }
docs: Attempt to write a single object.
  @param in the collection which contains objects to write.
  @return The value that should be decremented from the write quantum which starts at
  {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
  <ul>
  <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
  is encountered</li>
  <li>1 - if a single call to write data was made to the OS</li>
  <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no
  data was accepted</li>
  </ul>
  @throws Exception If an I/O error occurs.