Home / Class/ MemoryAttribute Class — netty Architecture

MemoryAttribute Class — netty Architecture

Architecture documentation for the MemoryAttribute class in MemoryAttribute.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6c399a89_7753_f796_2abf_5c169160e6c8["MemoryAttribute"]
  1737ff79_ed1c_45e0_9baa_c6859defabc3["MemoryAttribute.java"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|defined in| 1737ff79_ed1c_45e0_9baa_c6859defabc3
  037bad93_47a2_70d3_43d6_42c9b936659b["MemoryAttribute()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 037bad93_47a2_70d3_43d6_42c9b936659b
  868c66b1_d929_5f92_532b_621349796656["HttpDataType()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 868c66b1_d929_5f92_532b_621349796656
  3cd0b1f3_511a_af35_3e9b_04b38840767b["String()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 3cd0b1f3_511a_af35_3e9b_04b38840767b
  f9ecafe7_69e1_a10f_785f_98dfe871e9dd["setValue()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| f9ecafe7_69e1_a10f_785f_98dfe871e9dd
  80fbc0dd_492a_7fd1_ea5c_88c4bde76ef9["addContent()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 80fbc0dd_492a_7fd1_ea5c_88c4bde76ef9
  5d9a5654_c446_654b_6212_0d728945e650["hashCode()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 5d9a5654_c446_654b_6212_0d728945e650
  a99a5285_1b2a_a4e1_8a6f_b0670700d2e6["equals()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| a99a5285_1b2a_a4e1_8a6f_b0670700d2e6
  48edbece_1f3b_d6d3_38a4_90616f0f5462["compareTo()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 48edbece_1f3b_d6d3_38a4_90616f0f5462
  1ea6bdba_4e0b_5e0e_9ffa_e7d2c502555c["Attribute()"]
  6c399a89_7753_f796_2abf_5c169160e6c8 -->|method| 1ea6bdba_4e0b_5e0e_9ffa_e7d2c502555c

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java lines 31–197

public class MemoryAttribute extends AbstractMemoryHttpData implements Attribute {

    public MemoryAttribute(String name) {
        this(name, HttpConstants.DEFAULT_CHARSET);
    }

    public MemoryAttribute(String name, long definedSize) {
        this(name, definedSize, HttpConstants.DEFAULT_CHARSET);
    }

    public MemoryAttribute(String name, Charset charset) {
        super(name, charset, 0);
    }

    public MemoryAttribute(String name, long definedSize, Charset charset) {
        super(name, charset, definedSize);
    }

    public MemoryAttribute(String name, String value) throws IOException {
        this(name, value, HttpConstants.DEFAULT_CHARSET); // Attribute have no default size
    }

    public MemoryAttribute(String name, String value, Charset charset) throws IOException {
        super(name, charset, 0); // Attribute have no default size
        setValue(value);
    }

    @Override
    public HttpDataType getHttpDataType() {
        return HttpDataType.Attribute;
    }

    @Override
    public String getValue() {
        return getByteBuf().toString(getCharset());
    }

    @Override
    public void setValue(String value) throws IOException {
        ObjectUtil.checkNotNull(value, "value");
        byte [] bytes = value.getBytes(getCharset());
        checkSize(bytes.length);
        ByteBuf buffer = wrappedBuffer(bytes);
        if (definedSize > 0) {
            definedSize = buffer.readableBytes();
        }
        setContent(buffer);
    }

    @Override
    public void addContent(ByteBuf buffer, boolean last) throws IOException {
        int localsize = buffer.readableBytes();
        try {
            checkSize(size + localsize);
        } catch (IOException e) {
            buffer.release();
            throw e;
        }
        if (definedSize > 0 && definedSize < size + localsize) {
            definedSize = size + localsize;
        }
        super.addContent(buffer, last);
    }

    @Override
    public int hashCode() {
        return getName().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Attribute)) {
            return false;
        }
        Attribute attribute = (Attribute) o;
        return getName().equalsIgnoreCase(attribute.getName());
    }

    @Override
    public int compareTo(InterfaceHttpData other) {
        if (!(other instanceof Attribute)) {

Frequently Asked Questions

What is the MemoryAttribute class?
MemoryAttribute is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java.
Where is MemoryAttribute defined?
MemoryAttribute is defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free