Use this class for writing a set of key value pair strings to an output stream using the Java properties format.
Example #1
0
        /// <summary>
        /// Store the contents of this collection of properties to the stream in the format
        /// used for Java ".properties" files using an instance of <see cref="JavaPropertyWriter"/>.
        /// The keys and values will be minimally escaped to ensure special characters are read back
        /// in properly.  Keys are not sorted.  The file may begin with a comment identifying the
        /// date - and an additional comment may be included.
        /// </summary>
        /// <param name="streamOut">An output stream to write the properties to.</param>
        /// <param name="comments">Optional additional comment to include at the head of the output.</param>
        /// <param name="encoding">The <see cref="System.Text.Encoding">encoding</see> that is used to write the properies file stream.</param>
        /// <param name="outputTimestamp">Indicate that a comment with a timestamp should be output (true) or not (false).</param>
        public void Store(Stream streamOut, string comments, Encoding encoding, bool outputTimestamp)
        {
            JavaPropertyWriter writer = new JavaPropertyWriter(this);

            writer.OutputTimestamp = outputTimestamp;
            writer.Write(streamOut, comments, encoding);
        }
Example #2
0
        /// <summary>
        /// Store the contents of this collection of properties to the stream in the format
        /// used for Java ".properties" files using an instance of <see cref="JavaPropertyWriter"/>.
        /// The keys and values will be minimally escaped to ensure special characters are read back
        /// in properly.  Keys are not sorted.  The file may begin with a comment identifying the
        /// date.
        /// </summary>
        /// <param name="streamOut">An output stream to write the properties to.</param>
        /// <param name="outputTimestamp">Indicate that a comment with a timestamp should be output (true) or not (false).</param>
        public void Store(Stream streamOut, bool outputTimestamp)
        {
            JavaPropertyWriter writer = new JavaPropertyWriter(this);

            writer.OutputTimestamp = outputTimestamp;
            writer.Write(streamOut, null);
        }
Example #3
0
        public void store(java.io.Writer toWrite, String comments)
        {
            Kajabity.Tools.Java.JavaPropertyWriter reader = new Kajabity.Tools.Java.JavaPropertyWriter(this);
            reader.Write(
                new biz.ritter.io.StreamWrapper(
                    null,
                    new WriterOutputStream(toWrite) // better replace by converted Apache commons IO
                    ),
                comments
                );

            /* old but only with changes usable
             * Kajabity.Tools.Java.JavaPropertyWriter writer = new Kajabity.Tools.Java.JavaPropertyWriter(this);
             * writer.Write(toWrite, comments);
             */
        }
Example #4
0
        /// <summary>
        /// Store the contents of this collection of properties to the stream in the format
        /// used for Java ".properties" files using an instance of <see cref="JavaPropertyWriter"/>.
        /// The keys and values will be minimally escaped to ensure special characters are read back
        /// in properly.  Keys are not sorted.  The file will begin with a comment identifying the
        /// date - and an additional comment may be included.
        /// </summary>
        /// <param name="streamOut">An output stream to write the properties to.</param>
        /// <param name="comments">Optional additional comment to include at the head of the output (null to omit).</param>
        public void Store(Stream streamOut, string comments)
        {
            JavaPropertyWriter writer = new JavaPropertyWriter(this);

            writer.Write(streamOut, comments);
        }
 /// <summary>
 /// Store the contents of this collection of properties to the stream in the format
 /// used for Java ".properties" files using an instance of <see cref="JavaPropertyWriter"/>.
 /// The keys and values will be minimally escaped to ensure special characters are read back
 /// in properly.  Keys are not sorted.  The file will begin with a comment identifying the
 /// date - and an additional comment may be included.
 /// </summary>
 /// <param name="streamOut">An output stream to write the properties to.</param>
 /// <param name="comments">Optional additional comment to include at the head of the output.</param>
 public void Store( Stream streamOut, string comments )
 {
     JavaPropertyWriter writer = new JavaPropertyWriter( this );
     writer.Write( streamOut, comments );
 }