chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1714233 - in /chemistry/dotcmis/trunk/DotCMIS/binding: atompub/atompub-writer.cs atompub/atompub.cs converter.cs
Date Fri, 13 Nov 2015 16:04:29 GMT
Author: fmui
Date: Fri Nov 13 16:04:29 2015
New Revision: 1714233

URL: http://svn.apache.org/viewvc?rev=1714233&view=rev
Log:
CMIS-955: increased buffers for better upload performance

Modified:
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/converter.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs?rev=1714233&r1=1714232&r2=1714233&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs Fri Nov 13 16:04:29
2015
@@ -87,69 +87,72 @@ namespace DotCMIS.Binding.AtomPub
             XmlWriterSettings xmlWriterSettings = new XmlWriterSettings();
             xmlWriterSettings.Encoding = new UTF8Encoding(false);
 
-            using (XmlWriter writer = XmlWriter.Create(outStream, xmlWriterSettings))
+            using (BufferedStream bufferedStream = new BufferedStream(outStream, 64 * 1204))
             {
-                // start doc
-                writer.WriteStartDocument();
-
-                // start entry
-                writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagEntry,
AtomPubConstants.NamespaceAtom);
-                writer.WriteAttributeString("xmlns", AtomWriter.PrefixAtom, null, AtomPubConstants.NamespaceAtom);
-                writer.WriteAttributeString("xmlns", AtomWriter.PrefixCMIS, null, AtomPubConstants.NamespaceCMIS);
-                writer.WriteAttributeString("xmlns", AtomWriter.PrefixRestAtom, null, AtomPubConstants.NamespaceRestAtom);
-                if (filename != null)
+                using (XmlWriter writer = XmlWriter.Create(bufferedStream, xmlWriterSettings))
                 {
-                    writer.WriteAttributeString("xmlns", AtomWriter.PrefixApacheChemistry,
null, AtomPubConstants.NamespaceApacheChemistry);
-                }
+                    // start doc
+                    writer.WriteStartDocument();
 
-                // atom:id
-                writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomId,
AtomPubConstants.NamespaceAtom);
-                writer.WriteString("urn:uuid:00000000-0000-0000-0000-00000000000");
-                writer.WriteEndElement();
-
-                // atom:title
-                writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomTitle,
AtomPubConstants.NamespaceAtom);
-                writer.WriteString(GetTitle());
-                writer.WriteEndElement();
-
-                // atom:updated
-                writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomUpdated,
AtomPubConstants.NamespaceAtom);
-                writer.WriteString(GetUpdated());
-                writer.WriteEndElement();
+                    // start entry
+                    writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagEntry,
AtomPubConstants.NamespaceAtom);
+                    writer.WriteAttributeString("xmlns", AtomWriter.PrefixAtom, null, AtomPubConstants.NamespaceAtom);
+                    writer.WriteAttributeString("xmlns", AtomWriter.PrefixCMIS, null, AtomPubConstants.NamespaceCMIS);
+                    writer.WriteAttributeString("xmlns", AtomWriter.PrefixRestAtom, null,
AtomPubConstants.NamespaceRestAtom);
+                    if (filename != null)
+                    {
+                        writer.WriteAttributeString("xmlns", AtomWriter.PrefixApacheChemistry,
null, AtomPubConstants.NamespaceApacheChemistry);
+                    }
 
-                // content
-                if (stream != null)
-                {
-                    writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContent,
AtomPubConstants.NamespaceRestAtom);
+                    // atom:id
+                    writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomId,
AtomPubConstants.NamespaceAtom);
+                    writer.WriteString("urn:uuid:00000000-0000-0000-0000-00000000000");
+                    writer.WriteEndElement();
 
-                    writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContentMediatype,
AtomPubConstants.NamespaceRestAtom);
-                    writer.WriteString(mediaType);
+                    // atom:title
+                    writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomTitle,
AtomPubConstants.NamespaceAtom);
+                    writer.WriteString(GetTitle());
                     writer.WriteEndElement();
 
-                    if (filename != null)
+                    // atom:updated
+                    writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomUpdated,
AtomPubConstants.NamespaceAtom);
+                    writer.WriteString(GetUpdated());
+                    writer.WriteEndElement();
+
+                    // content
+                    if (stream != null)
                     {
-                        writer.WriteStartElement(AtomWriter.PrefixApacheChemistry, AtomPubConstants.TagContentFilename,
AtomPubConstants.NamespaceApacheChemistry);
-                        writer.WriteString(filename);
+                        writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContent,
AtomPubConstants.NamespaceRestAtom);
+
+                        writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContentMediatype,
AtomPubConstants.NamespaceRestAtom);
+                        writer.WriteString(mediaType);
                         writer.WriteEndElement();
-                    }
 
-                    writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContentBase64,
AtomPubConstants.NamespaceRestAtom);
-                    WriteContent(writer);
-                    writer.WriteEndElement();
+                        if (filename != null)
+                        {
+                            writer.WriteStartElement(AtomWriter.PrefixApacheChemistry, AtomPubConstants.TagContentFilename,
AtomPubConstants.NamespaceApacheChemistry);
+                            writer.WriteString(filename);
+                            writer.WriteEndElement();
+                        }
 
-                    writer.WriteEndElement();
-                }
+                        writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContentBase64,
AtomPubConstants.NamespaceRestAtom);
+                        WriteContent(writer);
+                        writer.WriteEndElement();
 
-                // object
-                AtomWriter.ObjectSerializer.Serialize(writer, cmisObject);
+                        writer.WriteEndElement();
+                    }
 
-                // end entry
-                writer.WriteEndElement();
+                    // object
+                    AtomWriter.ObjectSerializer.Serialize(writer, cmisObject);
 
-                // end document
-                writer.WriteEndDocument();
+                    // end entry
+                    writer.WriteEndElement();
 
-                writer.Flush();
+                    // end document
+                    writer.WriteEndDocument();
+
+                    writer.Flush();
+                }
             }
         }
 

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs?rev=1714233&r1=1714232&r2=1714233&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs Fri Nov 13 16:04:29 2015
@@ -2127,7 +2127,7 @@ namespace DotCMIS.Binding.AtomPub
             HttpUtils.Output output = delegate(Stream stream)
             {
                 int b;
-                byte[] buffer = new byte[4096];
+                byte[] buffer = new byte[64 * 1024];
                 while ((b = contentStream.Stream.Read(buffer, 0, buffer.Length)) > 0)
                 {
                     stream.Write(buffer, 0, b);

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/converter.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/converter.cs?rev=1714233&r1=1714232&r2=1714233&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/converter.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/converter.cs Fri Nov 13 16:04:29 2015
@@ -1697,7 +1697,7 @@ namespace DotCMIS.Binding
                 else
                 {
                     MemoryStream memStream = new MemoryStream();
-                    byte[] buffer = new byte[4096];
+                    byte[] buffer = new byte[64 * 1024];
                     int bytes;
                     while ((bytes = contentStream.Stream.Read(buffer, 0, buffer.Length))
> 0)
                     {



Mime
View raw message