Home / Function/ transferTo() — netty Function Reference

transferTo() — netty Function Reference

Architecture documentation for the transferTo() function in DefaultFileRegion.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bae3c5c8_62a5_1c82_ede3_eb8ba7bb58ba["transferTo()"]
  2525a814_0b60_9da3_6f4c_3129cbf6980c["DefaultFileRegion"]
  bae3c5c8_62a5_1c82_ede3_eb8ba7bb58ba -->|defined in| 2525a814_0b60_9da3_6f4c_3129cbf6980c
  d2eb7a4d_3733_4ff5_7e43_5a10fed21f1a["open()"]
  bae3c5c8_62a5_1c82_ede3_eb8ba7bb58ba -->|calls| d2eb7a4d_3733_4ff5_7e43_5a10fed21f1a
  7cf04b92_1a1a_0e5e_312a_55f4e2c4f328["validate()"]
  bae3c5c8_62a5_1c82_ede3_eb8ba7bb58ba -->|calls| 7cf04b92_1a1a_0e5e_312a_55f4e2c4f328
  style bae3c5c8_62a5_1c82_ede3_eb8ba7bb58ba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/DefaultFileRegion.java lines 113–141

    @Override
    public long transferTo(WritableByteChannel target, long position) throws IOException {
        long count = this.count - position;
        if (count < 0 || position < 0) {
            throw new IllegalArgumentException(
                    "position out of range: " + position +
                    " (expected: 0 - " + (this.count - 1) + ')');
        }
        if (count == 0) {
            return 0L;
        }
        if (refCnt() == 0) {
            throw new IllegalReferenceCountException(0);
        }
        // Call open to make sure fc is initialized. This is a no-oop if we called it before.
        open();

        long written = file.transferTo(this.position + position, count, target);
        if (written > 0) {
            transferred += written;
        } else if (written == 0) {
            // If the amount of written data is 0 we need to check if the requested count is bigger then the
            // actual file itself as it may have been truncated on disk.
            //
            // See https://github.com/netty/netty/issues/8868
            validate(this, position);
        }
        return written;
    }

Domain

Subdomains

Frequently Asked Questions

What does transferTo() do?
transferTo() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/DefaultFileRegion.java.
Where is transferTo() defined?
transferTo() is defined in transport/src/main/java/io/netty/channel/DefaultFileRegion.java at line 113.
What does transferTo() call?
transferTo() calls 2 function(s): open, validate.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free