Load the field value or file data from a Multipart request

@return {@code true} if the last chunk is loaded (boundary delimiter found), {@code false} if need more chunks
@throws ErrorDataDecoderException
423168
private static boolean loadDataMultipartStandard(ByteBuf undecodedChunk, String delimiter, HttpData httpData) {
        final int startReaderIndex = undecodedChunk.readerIndex();
        final int delimeterLength = delimiter.length();
        int index = 0;
        int lastPosition = startReaderIndex;
        byte prevByte = HttpConstants.LF;
        boolean delimiterFound = false;
        while (undecodedChunk.isReadable()) {
            final byte nextByte = undecodedChunk.readByte();
            // Check the delimiter
            if (prevByte == HttpConstants.LF && nextByte == delimiter.codePointAt(index)) {
                index++;
                if (delimeterLength == index) {
                    delimiterFound = true;
                    break;
                }
                continue;
            }
            lastPosition = undecodedChunk.readerIndex();
            if (nextByte == HttpConstants.LF) {
                index = 0;
                lastPosition -= (prevByte == HttpConstants.CR)? 2 : 1;
            }
            prevByte = nextByte;
        }
        if (prevByte == HttpConstants.CR) {
            lastPosition--;
        }
        ByteBuf content = undecodedChunk.copy(startReaderIndex, lastPosition - startReaderIndex);
        try {
            httpData.addContent(content, delimiterFound);
        } catch (IOException e) {
            throw new ErrorDataDecoderException(e);
        }
        undecodedChunk.readerIndex(lastPosition);
        return delimiterFound;
    }
229607
protected boolean loadMore()
        throws XMLStreamException
    {
        WstxInputSource input = mInput;
        do {
            /* Need to make sure offsets are properly updated for error
             * reporting purposes, and do this now while previous amounts
             * are still known.
             */
            mCurrInputProcessed += mInputEnd;
            verifyLimit("Maximum document characters", mConfig.getMaxCharacters(), mCurrInputProcessed);
            mCurrInputRowStart -= mInputEnd;
            int count;
            try {
                count = input.readInto(this);
                if (count > 0) {
                    return true;
                }
                input.close();
            } catch (IOException ioe) {
                throw constructFromIOE(ioe);
            }
            if (input == mRootInput) {
                /* Note: no need to check entity/input nesting in this
                 * particular case, since it will be handled by higher level
                 * parsing code (results in an unexpected EOF)
                 */
                return false;
            }
            WstxInputSource parent = input.getParent();
            if (parent == null) { // sanity check!
                throwNullParent(input);
            }
            /* 13-Feb-2006, TSa: Ok, do we violate a proper nesting constraints
             *   with this input block closure?
             */
            if (mCurrDepth != input.getScopeId()) {
                handleIncompleteEntityProblem(input);
            }

            mInput = input = parent;
            input.restoreContext(this);
            mInputTopDepth = input.getScopeId();
            /* 21-Feb-2006, TSa: Since linefeed normalization needs to be
             *   suppressed for internal entity expansion, we may need to
             *   change the state...
             */
            if (!mNormalizeLFs) {
                mNormalizeLFs = !input.fromInternalEntity();
            }
            // Maybe there are leftovers from that input in buffer now?
        } while (mInputPtr >= mInputEnd);

        return true;
    }
366642
public static final boolean isMultipartContent(HttpServletRequest request) {
		if (!RestConst.POST_METHOD.equalsIgnoreCase(request.getMethod())) {
			return false;
		}
		String contentType = request.getContentType();
		if (contentType == null) {
			return false;
		}
		contentType = contentType.toLowerCase(Locale.ENGLISH);
		if (contentType.startsWith(RestConst.MULTIPART) 
				|| MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
			return true;
		}
		return false;
	}
1190883
@Override
    public HttpContent readChunk(ByteBufAllocator allocator) throws Exception {
        if (isLastChunkSent) {
            return null;
        } else {
            HttpContent nextChunk = nextChunk();
            globalProgress += nextChunk.content().readableBytes();
            return nextChunk;
        }
    }
372496
private void processHeaderString(String dataHeader) {
		isFile = dataHeader.indexOf("filename") > 0;
		formFieldName = getDataFieldValue(dataHeader, "name");
		if (isFile) {
			formFileName = getDataFieldValue(dataHeader, "filename");
			if (formFileName == null) {
				return;
			}
			if (formFileName.length() == 0) {
				path = StrUtil.EMPTY;
				fileName = StrUtil.EMPTY;
			}
			int ls = FileUtil.lastIndexOfSeparator(formFileName);
			if (ls == -1) {
				path = StrUtil.EMPTY;
				fileName = formFileName;
			} else {
				path = formFileName.substring(0, ls);
				fileName = formFileName.substring(ls);
			}
			if (fileName.length() > 0) {
				this.contentType = getContentType(dataHeader);
				mimeType = getMimeType(contentType);
				mimeSubtype = getMimeSubtype(contentType);
				contentDisposition = getContentDisposition(dataHeader);
			}
		}
	}
394480
public void doProcess(HttpServletRequest req, HttpServletResponse res) 
		throws ServletException, IOException
	{
		PrintStream out = System.out;
		Properties properties = new Properties();
		String strTargetDirectory = this.getDestDirectory();
		
		String strReceiveMessage = gstrBlank;
		try	{
			MultipartRequest multi = new MultipartRequest(req, strTargetDirectory, MAX_SIZE);

			this.parseProperties(properties, multi);
			if (DEBUG)
				out.println();
			if (DEBUG)
				out.println("Files:");
			Enumeration<?> files = multi.getFileNames();
			while (files.hasMoreElements())
			{
				String name = (String)files.nextElement();
				String filename = multi.getFilesystemName(name);
				String type = multi.getContentType(name);
				File f = multi.getFile(name);
				if (DEBUG)
				{
					out.println("name: " + name);
					out.println("filename: " + filename);
					out.println("type: " + type);
					if (f != null) {
						out.println("f.toString(): " + f.toString());
						out.println("f.getName(): " + f.getName());
						out.println("f.exists(): " + f.exists());
						out.println("f.length(): " + f.length());
						out.println();
					}
				}

				if (f != null)
					strReceiveMessage += this.successfulFileUpload(f, properties);
			}
		} catch (IOException ex)	{
			String strError = ex.getMessage();
			if (strError.toLowerCase().indexOf("isn't multipart/form-data") != -1)
				strReceiveMessage = gstrBlank;	// Didn't specify a file (probably first time through)
			else
				strReceiveMessage = "<p>Previous upload not successful. Error: " + ex.getMessage() + "</p>" + RETURN;
		}
		this.sendForm(req, res, strReceiveMessage, properties);
	}
65496
private String getFormDataId(HttpServletRequest request) {

        String result = request.getParameter(CmsUgcConstants.PARAM_FORM_DATA_ID);
        return result;
    }
361540
public static boolean isMultipart(HttpServletRequest request) {
		if (false == isPostMethod(request)) {
			return false;
		}

		String contentType = request.getContentType();
		if (StrUtil.isBlank(contentType)) {
			return false;
		}
		if (contentType.toLowerCase().startsWith("multipart/")) {
			return true;
		}

		return false;
	}
1188343
public static boolean isMultipartContent(HttpServletRequest request) {
		if (!"post".equals(request.getMethod().toLowerCase())) {
			return false;
		}

		String contentType = request.getContentType();
		if (contentType == null) {
			return false;
		}
		if (contentType.toLowerCase().startsWith(MULTIPART)) {
			return true;
		}

		return false;
	}
748512
protected boolean parseFields(ByteBuffer buffer) {
        // Process headers
        while ((_state == State.HEADER || _state == State.TRAILER) && buffer.hasRemaining()) {
            // process each character
            HttpTokens.Token t = next(buffer);
            if (t == null)
                break;

            if (_maxHeaderBytes > 0 && ++_headerBytes > _maxHeaderBytes) {
                boolean header = _state == State.HEADER;
                LOG.warn("{} is too large {}>{}", header ? "Header" : "Trailer", _headerBytes, _maxHeaderBytes);
                throw new BadMessageException(header ?
                        HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431 :
                        HttpStatus.PAYLOAD_TOO_LARGE_413);
            }

            switch (_fieldState) {
                case FIELD:
                    switch (t.getType()) {
                        case COLON:
                        case SPACE:
                        case HTAB: {
                            if (complianceViolation(HttpComplianceSection.NO_FIELD_FOLDING, _headerString))
                                throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "Header Folding");

                            // header value without name - continuation?
                            if (_valueString == null || _valueString.isEmpty()) {
                                _string.setLength(0);
                                _length = 0;
                            } else {
                                setString(_valueString);
                                _string.append(' ');
                                _length++;
                                _valueString = null;
                            }
                            setState(FieldState.VALUE);
                            break;
                        }

                        case LF: {
                            // process previous header
                            if (_state == State.HEADER)
                                parsedHeader();
                            else
                                parsedTrailer();

                            _contentPosition = 0;

                            // End of headers or trailers?
                            if (_state == State.TRAILER) {
                                setState(State.END);
                                return _handler.messageComplete();
                            }

                            // Was there a required host header?
                            if (!_host && _version == HttpVersion.HTTP_1_1 && _requestHandler != null) {
                                throw new BadMessageException(HttpStatus.BAD_REQUEST_400, "No Host");
                            }

                            // is it a response that cannot have a body?
                            if (_responseHandler != null && // response
                                    (_responseStatus == 304 || // not-modified response
                                            _responseStatus == 204 || // no-content response
                                            _responseStatus < 200)) // 1xx response
                                _endOfContent = EndOfContent.NO_CONTENT; // ignore any other headers set

                                // else if we don't know framing
                            else if (_endOfContent == EndOfContent.UNKNOWN_CONTENT) {
                                if (_responseStatus == 0  // request
                                        || _responseStatus == 304 // not-modified response
                                        || _responseStatus == 204 // no-content response
                                        || _responseStatus < 200) // 1xx response
                                    _endOfContent = EndOfContent.NO_CONTENT;
                                else
                                    _endOfContent = EndOfContent.EOF_CONTENT;
                            }

                            // How is the message ended?
                            switch (_endOfContent) {
                                case EOF_CONTENT: {
                                    setState(State.EOF_CONTENT);
                                    boolean handle = _handler.headerComplete();
                                    _headerComplete = true;
                                    return handle;
                                }
                                case CHUNKED_CONTENT: {
                                    setState(State.CHUNKED_CONTENT);
                                    boolean handle = _handler.headerComplete();
                                    _headerComplete = true;
                                    return handle;
                                }
                                case NO_CONTENT: {
                                    setState(State.END);
                                    return handleHeaderContentMessage();
                                }
                                default: {
                                    setState(State.CONTENT);
                                    boolean handle = _handler.headerComplete();
                                    _headerComplete = true;
                                    return handle;
                                }
                            }
                        }

                        case ALPHA:
                        case DIGIT:
                        case TCHAR: {
                            // process previous header
                            if (_state == State.HEADER)
                                parsedHeader();
                            else
                                parsedTrailer();

                            // handle new header
                            if (buffer.hasRemaining()) {
                                // Try a look ahead for the known header name and value.
                                HttpField cached_field = _fieldCache == null ? null : _fieldCache.getBest(buffer, -1, buffer.remaining());
                                if (cached_field == null)
                                    cached_field = CACHE.getBest(buffer, -1, buffer.remaining());

                                if (cached_field != null) {
                                    String n = cached_field.getName();
                                    String v = cached_field.getValue();

                                    if (!_compliances.contains(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE)) {
                                        // Have to get the fields exactly from the buffer to match case
                                        String en = BufferUtils.toString(buffer, buffer.position() - 1, n.length(), StandardCharsets.US_ASCII);
                                        if (!n.equals(en)) {
                                            handleViolation(HttpComplianceSection.FIELD_NAME_CASE_INSENSITIVE, en);
                                            n = en;
                                            cached_field = new HttpField(cached_field.getHeader(), n, v);
                                        }
                                    }

                                    if (v != null && !_compliances.contains(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE)) {
                                        String ev = BufferUtils.toString(buffer, buffer.position() + n.length() + 1, v.length(), StandardCharsets.ISO_8859_1);
                                        if (!v.equals(ev)) {
                                            handleViolation(HttpComplianceSection.CASE_INSENSITIVE_FIELD_VALUE_CACHE, ev + "!=" + v);
                                            v = ev;
                                            cached_field = new HttpField(cached_field.getHeader(), n, v);
                                        }
                                    }

                                    _header = cached_field.getHeader();
                                    _headerString = n;

                                    if (v == null) {
                                        // Header only
                                        setState(FieldState.VALUE);
                                        _string.setLength(0);
                                        _length = 0;
                                        buffer.position(buffer.position() + n.length() + 1);
                                        break;
                                    }

                                    // Header and value
                                    int pos = buffer.position() + n.length() + v.length() + 1;
                                    byte peek = buffer.get(pos);
                                    if (peek == HttpTokens.CARRIAGE_RETURN || peek == HttpTokens.LINE_FEED) {
                                        _field = cached_field;
                                        _valueString = v;
                                        setState(FieldState.IN_VALUE);

                                        if (peek == HttpTokens.CARRIAGE_RETURN) {
                                            _cr = true;
                                            buffer.position(pos + 1);
                                        } else
                                            buffer.position(pos);
                                        break;
                                    }
                                    setState(FieldState.IN_VALUE);
                                    setString(v);
                                    buffer.position(pos);
                                    break;
                                }
                            }

                            // New header
                            setState(FieldState.IN_NAME);
                            _string.setLength(0);
                            _string.append(t.getChar());
                            _length = 1;
                        }
                        break;

                        default:
                            throw new IllegalCharacterException(_state, t, buffer);
                    }
                    break;

                case IN_NAME:
                    switch (t.getType()) {
                        case SPACE:
                        case HTAB:
                            //Ignore trailing whitespaces ?
                            if (!complianceViolation(HttpComplianceSection.NO_WS_AFTER_FIELD_NAME, null)) {
                                _headerString = takeString();
                                _header = HttpHeader.CACHE.get(_headerString);
                                _length = -1;
                                setState(FieldState.WS_AFTER_NAME);
                                break;
                            }
                            throw new IllegalCharacterException(_state, t, buffer);

                        case COLON:
                            _headerString = takeString();
                            _header = HttpHeader.CACHE.get(_headerString);
                            _length = -1;
                            setState(FieldState.VALUE);
                            break;

                        case LF:
                            _headerString = takeString();
                            _header = HttpHeader.CACHE.get(_headerString);
                            _string.setLength(0);
                            _valueString = "";
                            _length = -1;

                            if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
                                setState(FieldState.FIELD);
                                break;
                            }
                            throw new IllegalCharacterException(_state, t, buffer);

                        case ALPHA:
                        case DIGIT:
                        case TCHAR:
                            _string.append(t.getChar());
                            _length = _string.length();
                            break;

                        default:
                            throw new IllegalCharacterException(_state, t, buffer);
                    }
                    break;

                case WS_AFTER_NAME:

                    switch (t.getType()) {
                        case SPACE:
                        case HTAB:
                            break;

                        case COLON:
                            setState(FieldState.VALUE);
                            break;

                        case LF:
                            if (!complianceViolation(HttpComplianceSection.FIELD_COLON, _headerString)) {
                                setState(FieldState.FIELD);
                                break;
                            }
                            throw new IllegalCharacterException(_state, t, buffer);

                        default:
                            throw new IllegalCharacterException(_state, t, buffer);
                    }
                    break;

                case VALUE:
                    switch (t.getType()) {
                        case LF:
                            _string.setLength(0);
                            _valueString = "";
                            _length = -1;

                            setState(FieldState.FIELD);
                            break;

                        case SPACE:
                        case HTAB:
                            break;

                        case ALPHA:
                        case DIGIT:
                        case TCHAR:
                        case VCHAR:
                        case COLON:
                        case OTEXT: // TODO review? should this be a utf8 string?
                            _string.append(t.getChar());
                            _length = _string.length();
                            setState(FieldState.IN_VALUE);
                            break;

                        default:
                            throw new IllegalCharacterException(_state, t, buffer);
                    }
                    break;

                case IN_VALUE:
                    switch (t.getType()) {
                        case LF:
                            if (_length > 0) {
                                _valueString = takeString();
                                _length = -1;
                            }
                            setState(FieldState.FIELD);
                            break;

                        case SPACE:
                        case HTAB:
                            _string.append(t.getChar());
                            break;

                        case ALPHA:
                        case DIGIT:
                        case TCHAR:
                        case VCHAR:
                        case COLON:
                        case OTEXT: // TODO review? should this be a utf8 string?
                            _string.append(t.getChar());
                            _length = _string.length();
                            break;

                        default:
                            throw new IllegalCharacterException(_state, t, buffer);
                    }
                    break;

                default:
                    throw new IllegalStateException(_state.toString());

            }
        }

        return false;
    }
618829
private boolean load(InputStream in) throws IOException, StreamCorruptedException {
        boolean updated = false;
        Iterable<Version> loadedVersions = loadData(in);
        for (Version loadedVersion : loadedVersions) {
            // see https://github.com/ThreeTen/threetenbp/pull/28 for issue wrt
            // multiple versions of lib on classpath
            Version existing = versions.putIfAbsent(loadedVersion.versionId, loadedVersion);
            if (existing != null && !existing.versionId.equals(loadedVersion.versionId)) {
                throw new ZoneRulesException("Data already loaded for TZDB time-zone rules version: " + loadedVersion.versionId);
            }
            updated = true;
        }
        return updated;
    }
818554
@Override
    public boolean hasNext() {
        if (readBuffer != null && readBuffer.remaining() != 0) {
            logger.debug("There are still elements in the readBuffer");
            return true;
        } else if (actualFile != null && actualFileOffset < actualFile.getFilledUpFromContentStart()) {
            logger.debug("The end of the actual file is not reached yet.");
            return true;
        } // Since version 0.2.23-SNAPSHOT all files are created, even if they don't contain elements
        else if (actualBucketId < numberOfBuckets - 1) {
            logger.debug("Not all files were read. Trying to open next file");
            try {
                this.handleFile();
            } catch (FileLockException e) {
                logger.error("Skipping file. Not all elements might have been iterated. {}", e);
            } catch (IOException e) {
                logger.error("Skipping file. Not all elements might have been iterated. {}", e);
            }
            return hasNext();
        }

        if (actualFile != null) {
            actualFile.close();
        }
        return false;
    }
417196
private InterfaceHttpData findMultipartDisposition() {
        int readerIndex = undecodedChunk.readerIndex();
        if (currentStatus == MultiPartStatus.DISPOSITION) {
            currentFieldAttributes = new TreeMap<CharSequence, Attribute>(CaseIgnoringComparator.INSTANCE);
        }
        // read many lines until empty line with newline found! Store all data
        while (!skipOneLine()) {
            String newline;
            try {
                skipControlCharacters(undecodedChunk);
                newline = readLine(undecodedChunk, charset);
            } catch (NotEnoughDataDecoderException ignored) {
                undecodedChunk.readerIndex(readerIndex);
                return null;
            }
            String[] contents = splitMultipartHeader(newline);
            if (HttpHeaderNames.CONTENT_DISPOSITION.contentEqualsIgnoreCase(contents[0])) {
                boolean checkSecondArg;
                if (currentStatus == MultiPartStatus.DISPOSITION) {
                    checkSecondArg = HttpHeaderValues.FORM_DATA.contentEqualsIgnoreCase(contents[1]);
                } else {
                    checkSecondArg = HttpHeaderValues.ATTACHMENT.contentEqualsIgnoreCase(contents[1])
                            || HttpHeaderValues.FILE.contentEqualsIgnoreCase(contents[1]);
                }
                if (checkSecondArg) {
                    // read next values and store them in the map as Attribute
                    for (int i = 2; i < contents.length; i++) {
                        String[] values = contents[i].split("=", 2);
                        Attribute attribute;
                        try {
                            attribute = getContentDispositionAttribute(values);
                        } catch (NullPointerException e) {
                            throw new ErrorDataDecoderException(e);
                        } catch (IllegalArgumentException e) {
                            throw new ErrorDataDecoderException(e);
                        }
                        currentFieldAttributes.put(attribute.getName(), attribute);
                    }
                }
            } else if (HttpHeaderNames.CONTENT_TRANSFER_ENCODING.contentEqualsIgnoreCase(contents[0])) {
                Attribute attribute;
                try {
                    attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_TRANSFER_ENCODING.toString(),
                            cleanString(contents[1]));
                } catch (NullPointerException e) {
                    throw new ErrorDataDecoderException(e);
                } catch (IllegalArgumentException e) {
                    throw new ErrorDataDecoderException(e);
                }

                currentFieldAttributes.put(HttpHeaderNames.CONTENT_TRANSFER_ENCODING, attribute);
            } else if (HttpHeaderNames.CONTENT_LENGTH.contentEqualsIgnoreCase(contents[0])) {
                Attribute attribute;
                try {
                    attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_LENGTH.toString(),
                            cleanString(contents[1]));
                } catch (NullPointerException e) {
                    throw new ErrorDataDecoderException(e);
                } catch (IllegalArgumentException e) {
                    throw new ErrorDataDecoderException(e);
                }

                currentFieldAttributes.put(HttpHeaderNames.CONTENT_LENGTH, attribute);
            } else if (HttpHeaderNames.CONTENT_TYPE.contentEqualsIgnoreCase(contents[0])) {
                // Take care of possible "multipart/mixed"
                if (HttpHeaderValues.MULTIPART_MIXED.contentEqualsIgnoreCase(contents[1])) {
                    if (currentStatus == MultiPartStatus.DISPOSITION) {
                        String values = StringUtil.substringAfter(contents[2], '=');
                        multipartMixedBoundary = "--" + values;
                        currentStatus = MultiPartStatus.MIXEDDELIMITER;
                        return decodeMultipart(MultiPartStatus.MIXEDDELIMITER);
                    } else {
                        throw new ErrorDataDecoderException("Mixed Multipart found in a previous Mixed Multipart");
                    }
                } else {
                    for (int i = 1; i < contents.length; i++) {
                        final String charsetHeader = HttpHeaderValues.CHARSET.toString();
                        if (contents[i].regionMatches(true, 0, charsetHeader, 0, charsetHeader.length())) {
                            String values = StringUtil.substringAfter(contents[i], '=');
                            Attribute attribute;
                            try {
                                attribute = factory.createAttribute(request, charsetHeader, cleanString(values));
                            } catch (NullPointerException e) {
                                throw new ErrorDataDecoderException(e);
                            } catch (IllegalArgumentException e) {
                                throw new ErrorDataDecoderException(e);
                            }
                            currentFieldAttributes.put(HttpHeaderValues.CHARSET, attribute);
                        } else {
                            Attribute attribute;
                            try {
                                attribute = factory.createAttribute(request,
                                        cleanString(contents[0]), contents[i]);
                            } catch (NullPointerException e) {
                                throw new ErrorDataDecoderException(e);
                            } catch (IllegalArgumentException e) {
                                throw new ErrorDataDecoderException(e);
                            }
                            currentFieldAttributes.put(attribute.getName(), attribute);
                        }
                    }
                }
            } else {
                throw new ErrorDataDecoderException("Unknown Params: " + newline);
            }
        }
        // Is it a FileUpload
        Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME);
        if (currentStatus == MultiPartStatus.DISPOSITION) {
            if (filenameAttribute != null) {
                // FileUpload
                currentStatus = MultiPartStatus.FILEUPLOAD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.FILEUPLOAD);
            } else {
                // Field
                currentStatus = MultiPartStatus.FIELD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.FIELD);
            }
        } else {
            if (filenameAttribute != null) {
                // FileUpload
                currentStatus = MultiPartStatus.MIXEDFILEUPLOAD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.MIXEDFILEUPLOAD);
            } else {
                // Field is not supported in MIXED mode
                throw new ErrorDataDecoderException("Filename not found");
            }
        }
    }
1028478
public RandomAccessData parse(RandomAccessData data, boolean skipPrefixBytes)
			throws IOException {
		CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data);
		if (skipPrefixBytes) {
			data = getArchiveData(endRecord, data);
		}
		RandomAccessData centralDirectoryData = endRecord.getCentralDirectory(data);
		visitStart(endRecord, centralDirectoryData);
		parseEntries(endRecord, centralDirectoryData);
		visitEnd();
		return data;
	}
196882
@Override
    public synchronized boolean load() {
        Either<Void, T> oldData = data;
        long oldModified = modified;
        String oldKey = versionedKey;
        try {
            if (isOutOfDate() || needsData()) {
                String newVersionedKey = reader.getAsString(key)
                                               .orElse(null);
                val loaded = nonAtomicload(newVersionedKey);
                data = Either.right((T) loaded._2());
                modified = loaded._1();
                versionedKey = newVersionedKey;
            } else {
                return false;
            }
        } catch (Throwable e) {
            data = oldData;
            versionedKey = oldKey;
            modified = oldModified;
            logger.info(e.getMessage(), e);
            throw ExceptionSoftener.throwSoftenedException(e);
        }
        return true;
    }
731553
public int doEndTag() throws JspException
    {
        HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();

        // if we are not handling multipart requests then we can't output the file upload tag and we will
        // report an error
        if (!InternalUtils.isMultipartHandlingEnabled(req)) {
            String s = Bundle.getString("Tags_FileMultiOff", null);
            registerTagError(s, null);
            return EVAL_PAGE;
        }

        // Create the state for the input tag.
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_FILE_TAG, req);
        br.doStartTag(writer, _state);

        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
476152
@Override
  public D readRecordImpl(@Deprecated D reuse) throws DataRecordException, IOException {
    this.totalRecordCount++;

    if (this.statusCount > 0 && this.totalRecordCount % this.statusCount == 0) {
      LOG.info("Total number of records processed so far: " + this.totalRecordCount);
    }

    // If records have been read, check the hasNext value, if not then get the next file to process
    if (this.currentFile != null && this.currentFileItr != null) {
      this.hasNext = this.currentFileItr.hasNext();

      // If the current file is done, move to the next one
      if (!this.hasNext) {
        getNextFileToRead();
      }
    } else {
      // If no records have been read yet, get the first file to process
      getNextFileToRead();
    }

    if (this.hasNext) {
      return this.currentFileItr.next();
    }

    LOG.info("Finished reading records from all files");
    return null;
  }