code: private int writeFileRegion(ChannelOutboundBuffer in, FileRegion region) throws Exception {
          if (region.transferred() >= region.count()) {
              in.remove();
              return 0;
          }
  
          if (byteChannel == null) {
              byteChannel = new KQueueSocketWritableByteChannel();
          }
          final long flushedAmount = region.transferTo(byteChannel, region.transferred());
          if (flushedAmount > 0) {
              in.progress(flushedAmount);
              if (region.transferred() >= region.count()) {
                  in.remove();
              }
              return 1;
          }
          return WRITE_STATUS_SNDBUF_FULL;
      }
docs: Write a {@link FileRegion}
  @param in the collection which contains objects to write.
  @param region the {@link FileRegion} from which the bytes should be written
  @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>