@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); }
@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); }
@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); }
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();
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }
@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); }