io.netty.handler.codec.http.multipart.Attribute.setContent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中io.netty.handler.codec.http.multipart.Attribute.setContent()方法的一些代码示例,展示了Attribute.setContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.setContent()方法的具体详情如下:
包路径:io.netty.handler.codec.http.multipart.Attribute
类名称:Attribute
方法名:setContent

Attribute.setContent介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public void setContent(File file) throws IOException {
  checkSize(file.length());
  if (file.length() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(file);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void setContent(ByteBuf buffer) throws IOException {
  checkSize(buffer.readableBytes());
  if (buffer.readableBytes() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(buffer);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void setContent(InputStream inputStream) throws IOException {
  if (attribute instanceof MemoryAttribute) {
    // change to Disk even if we don't know the size
    attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
    attribute.setMaxSize(maxSize);
  }
  attribute.setContent(inputStream);
}

代码示例来源:origin: stackoverflow.com

byte[] buf = new byte[200];
...
DefaultFullHttpRequest req = new DefaultFullHttpRequest(httpVersion, HttpMethod.POST, uri);
DefaultHttpDataFactory factory = new DefaultHttpDataFactory();
HttpPostRequestEncoder enc = new HttpPostRequestEncoder(factory, req, false, CharsetUtil.UTF_8, HttpPostRequestEncoder.EncoderMode.RFC1738);
Attribute attr = factory.createAttribute(req, "someBinaryVar");
attr.setContent(io.netty.buffer.Unpooled.wrappedBuffer(buf));
enc.addBodyHttpData(attr);
...
enc.finalizeRequest();

代码示例来源:origin: io.netty/netty-codec-http

@Override
public void setContent(ByteBuf buffer) throws IOException {
  checkSize(buffer.readableBytes());
  if (buffer.readableBytes() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(buffer);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setContent(ByteBuf buffer) throws IOException {
  checkSize(buffer.readableBytes());
  if (buffer.readableBytes() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(buffer);
}

代码示例来源:origin: io.netty/netty-codec-http

@Override
public void setContent(File file) throws IOException {
  checkSize(file.length());
  if (file.length() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(file);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public void setContent(File file) throws IOException {
  checkSize(file.length());
  if (file.length() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(file);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setContent(File file) throws IOException {
  checkSize(file.length());
  if (file.length() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(file);
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public void setContent(File file) throws IOException {
  checkSize(file.length());
  if (file.length() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(file);
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public void setContent(ByteBuf buffer) throws IOException {
  checkSize(buffer.readableBytes());
  if (buffer.readableBytes() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(buffer);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public void setContent(ByteBuf buffer) throws IOException {
  checkSize(buffer.readableBytes());
  if (buffer.readableBytes() > limitSize) {
    if (attribute instanceof MemoryAttribute) {
      // change to Disk
      attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
      attribute.setMaxSize(maxSize);
    }
  }
  attribute.setContent(buffer);
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public void setContent(InputStream inputStream) throws IOException {
  if (attribute instanceof MemoryAttribute) {
    // change to Disk even if we don't know the size
    attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
    attribute.setMaxSize(maxSize);
  }
  attribute.setContent(inputStream);
}

代码示例来源:origin: io.netty/netty-codec-http

@Override
public void setContent(InputStream inputStream) throws IOException {
  if (attribute instanceof MemoryAttribute) {
    // change to Disk even if we don't know the size
    attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
    attribute.setMaxSize(maxSize);
  }
  attribute.setContent(inputStream);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setContent(InputStream inputStream) throws IOException {
  if (attribute instanceof MemoryAttribute) {
    // change to Disk even if we don't know the size
    attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
    attribute.setMaxSize(maxSize);
  }
  attribute.setContent(inputStream);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public void setContent(InputStream inputStream) throws IOException {
  if (attribute instanceof MemoryAttribute) {
    // change to Disk even if we don't know the size
    attribute = new DiskAttribute(attribute.getName(), attribute.definedLength());
    attribute.setMaxSize(maxSize);
  }
  attribute.setContent(inputStream);
}

相关文章