private HttpChunk encodeNextChunkMultipart(int sizeleft) throws ErrorDataEncoderException {
        if (currentData == null) {
            return null;
        }
        ChannelBuffer buffer;
        if (currentData instanceof InternalAttribute) {
            String internal = ((InternalAttribute) currentData).toString();
            byte[] bytes;
            try {
                bytes = internal.getBytes("ASCII");
            } catch (UnsupportedEncodingException e) {
                throw new ErrorDataEncoderException(e);
            }
            buffer = ChannelBuffers.wrappedBuffer(bytes);
            currentData = null;
        } else {
            if (currentData instanceof Attribute) {
                try {
                    buffer = ((Attribute) currentData).getChunk(sizeleft);
                } catch (IOException e) {
                    throw new ErrorDataEncoderException(e);
                }
            } else {
                try {
                    buffer = ((FileUpload) currentData).getChunk(sizeleft);
                } catch (IOException e) {
                    throw new ErrorDataEncoderException(e);
                }
            }
            if (buffer.capacity() == 0) {
                // end for current InterfaceHttpData, need more data
                currentData = null;
                return null;
            }
        }
        if (currentBuffer == null) {
            currentBuffer = buffer;
        } else {
            currentBuffer = ChannelBuffers.wrappedBuffer(currentBuffer,
                buffer);
        }
        if (currentBuffer.readableBytes() < HttpPostBodyUtil.chunkSize) {
            currentData = null;
            return null;
        }
        buffer = fillChannelBuffer();
        return new DefaultHttpChunk(buffer);
    }