/** * Returns the Nth header name, or null if there is no such header. * This may be used to iterate through all header fields. */ public DataChunk getName(int n) { return n >= 0 && n < count ? headers[n].getName() : null; }
/** * Returns the Nth header value, or null if there is no such header. * This may be used to iterate through all header fields. */ public DataChunk getValue(int n) { return n >= 0 && n < count ? headers[n].getValue() : null; }
/** * Set the header's "serialized" flag. * * @param n the header index * @param newValue the new value * @return the old header "serialized" flag value. */ public boolean setSerialized(int n, boolean newValue) { final boolean value; if (n >= 0 && n < count) { final MimeHeaderField field = headers[n]; value = field.isSerialized(); field.setSerialized(newValue); } else { value = true; } return value; }
if (!isValidName(sourceField.getName().toString())) { continue; f = new MimeHeaderField(); headers[i] = f;
/** * Clears all header fields. */ public void clear() { for (int i = 0; i < count; i++) { headers[i].recycle(); } count = 0; mark = 0; marked = false; }
/** * Get the header's "serialized" flag. * * @param n the header index * @return the header's "serialized" flag value. */ public boolean isSerialized(int n) { if (n >= 0 && n < count) { final MimeHeaderField field = headers[n]; return field.isSerialized(); } return false; }
/** * Adds a partially constructed field to the header. This * field has not had its name or value initialized. */ private MimeHeaderField createHeader() { if (maxNumHeaders >= 0 && count == maxNumHeaders) { throw new MaxHeaderCountExceededException(); } MimeHeaderField mh; int len = headers.length; if (count >= len) { // expand header list array int newCount = count * 2; if (maxNumHeaders >= 0 && newCount > maxNumHeaders) { newCount = maxNumHeaders; } MimeHeaderField tmp[] = new MimeHeaderField[newCount]; System.arraycopy(headers, 0, tmp, 0, len); headers = tmp; } if ((mh = headers[count]) == null) { headers[count] = mh = new MimeHeaderField(); } count++; return mh; }
if (!isValidName(sourceField.getName().toString())) { continue; f = new MimeHeaderField(); headers[i] = f;
/** * reset and swap with last header * @param idx the index of the header to remove. */ void removeHeader(int idx) { MimeHeaderField mh = headers[idx]; mh.recycle(); headers[idx] = headers[count - 1]; headers[count - 1] = mh; count--; }
/** * Get the header's "serialized" flag. * * @param n the header index * @return the header's "serialized" flag value. */ public boolean isSerialized(int n) { if (n >= 0 && n < count) { final MimeHeaderField field = headers[n]; return field.isSerialized(); } return false; }
/** * Adds a partially constructed field to the header. This * field has not had its name or value initialized. */ private MimeHeaderField createHeader() { if (maxNumHeaders >= 0 && count == maxNumHeaders) { throw new MaxHeaderCountExceededException(); } MimeHeaderField mh; int len = headers.length; if (count >= len) { // expand header list array int newCount = count * 2; if (maxNumHeaders >= 0 && newCount > maxNumHeaders) { newCount = maxNumHeaders; } MimeHeaderField tmp[] = new MimeHeaderField[newCount]; System.arraycopy(headers, 0, tmp, 0, len); headers = tmp; } if ((mh = headers[count]) == null) { headers[count] = mh = new MimeHeaderField(); } count++; return mh; }
/** * Set the header's "serialized" flag. * * @param n the header index * @param newValue the new value * @return the old header "serialized" flag value. */ public boolean setSerialized(int n, boolean newValue) { final boolean value; if (n >= 0 && n < count) { final MimeHeaderField field = headers[n]; value = field.isSerialized(); field.setSerialized(newValue); } else { value = true; } return value; }
if (!isValidName(sourceField.getName().toString())) { continue; f = new MimeHeaderField(); headers[i] = f;
/** * Clears all header fields. */ public void clear() { for (int i = 0; i < count; i++) { headers[i].recycle(); } count = 0; mark = 0; marked = false; }
/** * Returns the Nth header value, or null if there is no such header. * This may be used to iterate through all header fields. */ public DataChunk getValue(int n) { return n >= 0 && n < count ? headers[n].getValue() : null; }
/** * Returns the Nth header name, or null if there is no such header. * This may be used to iterate through all header fields. */ public DataChunk getName(int n) { return n >= 0 && n < count ? headers[n].getName() : null; }
/** * Get the header's "serialized" flag. * * @param n the header index * @return the header's "serialized" flag value. */ public boolean isSerialized(int n) { if (n >= 0 && n < count) { final MimeHeaderField field = headers[n]; return field.isSerialized(); } return false; }