/// <summary> /// Writes the Manifest to the specified OutputStream. /// Attributes.Name.MANIFEST_VERSION must be set in /// MainAttributes prior to invoking this method. /// </summary> /// <param name="out"> the output stream </param> /// <exception cref="IOException"> if an I/O error has occurred </exception> /// <seealso cref= #getMainAttributes </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void write(java.io.OutputStream out) throws java.io.IOException public virtual void Write(OutputStream @out) { DataOutputStream dos = new DataOutputStream(@out); // Write out the main attributes for the manifest Attr.WriteMain(dos); // Now write out the pre-entry attributes IEnumerator <java.util.Map_Entry <String, Attributes> > it = Entries_Renamed.GetEnumerator(); while (it.MoveNext()) { java.util.Map_Entry <String, Attributes> e = it.Current; StringBuffer buffer = new StringBuffer("Name: "); String value = e.Key; if (value != null) { sbyte[] vb = value.GetBytes("UTF8"); value = StringHelperClass.NewString(vb, 0, 0, vb.Length); } buffer.Append(value); buffer.Append("\r\n"); Make72Safe(buffer); dos.WriteBytes(buffer.ToString()); e.Value.Write(dos); } dos.Flush(); }
/* * Writes the current attributes to the specified data output stream, * make sure to write out the MANIFEST_VERSION or SIGNATURE_VERSION * attributes first. * * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void writeMain(java.io.DataOutputStream out) throws java.io.IOException internal virtual void WriteMain(DataOutputStream @out) { // write out the *-Version header first, if it exists String vername = Name.MANIFEST_VERSION.ToString(); String version = GetValue(vername); if (version == java.util.Map_Fields.Null) { vername = Name.SIGNATURE_VERSION.ToString(); version = GetValue(vername); } if (version != java.util.Map_Fields.Null) { @out.WriteBytes(vername + ": " + version + "\r\n"); } // write out all attributes except for the version // we wrote out earlier IEnumerator <java.util.Map_Entry <Object, Object> > it = EntrySet().Iterator(); while (it.MoveNext()) { java.util.Map_Entry <Object, Object> e = it.Current; String name = ((Name)e.Key).ToString(); if ((version != java.util.Map_Fields.Null) && !(name.EqualsIgnoreCase(vername))) { StringBuffer buffer = new StringBuffer(name); buffer.Append(": "); String value = (String)e.Value; if (value != java.util.Map_Fields.Null) { sbyte[] vb = value.GetBytes("UTF8"); value = StringHelperClass.NewString(vb, 0, 0, vb.Length); } buffer.Append(value); buffer.Append("\r\n"); Manifest.Make72Safe(buffer); @out.WriteBytes(buffer.ToString()); } } @out.WriteBytes("\r\n"); }
} // hashCode() /// <summary> /// Two parameter lists are considered equal if they have exactly /// the same set of parameter names and associated values. The /// order of the parameters is not considered. /// </summary> public override bool Equals(Object thatObject) { //System.out.println("MimeTypeParameterList.equals("+this+","+thatObject+")"); if (!(thatObject is MimeTypeParameterList)) { return(false); } MimeTypeParameterList that = (MimeTypeParameterList)thatObject; if (this.Size() != that.Size()) { return(false); } String name = null; String thisValue = null; String thatValue = null; //JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'entrySet' method: Set <java.util.Map_Entry <String, String> > entries = Parameters.entrySet(); IEnumerator <java.util.Map_Entry <String, String> > iterator = entries.Iterator(); java.util.Map_Entry <String, String> entry = null; while (iterator.MoveNext()) { entry = iterator.Current; name = entry.Key; thisValue = entry.Value; thatValue = that.Parameters[name]; if ((thisValue == null) || (thatValue == null)) { // both null -> equal, only one null -> not equal if (thisValue != thatValue) { return(false); } } else if (!thisValue.Equals(thatValue)) { return(false); } } // while iterator return(true); } // equals()
/* * Writes the current attributes to the specified data output stream. * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void write(java.io.DataOutputStream os) throws java.io.IOException internal virtual void Write(DataOutputStream os) { IEnumerator <java.util.Map_Entry <Object, Object> > it = EntrySet().Iterator(); while (it.MoveNext()) { java.util.Map_Entry <Object, Object> e = it.Current; StringBuffer buffer = new StringBuffer(((Name)e.Key).ToString()); buffer.Append(": "); String value = (String)e.Value; if (value != java.util.Map_Fields.Null) { sbyte[] vb = value.GetBytes("UTF8"); value = StringHelperClass.NewString(vb, 0, 0, vb.Length); } buffer.Append(value); buffer.Append("\r\n"); Manifest.Make72Safe(buffer); os.WriteBytes(buffer.ToString()); } os.WriteBytes("\r\n"); }
protected internal virtual bool RemoveEldestEntry(java.util.Map_Entry <String, Entry> eldest) { return(size() > OuterInstance.MAX_ENTRIES); }