diff --git a/applications/test/CompactListList/Test-CompactListList.C b/applications/test/CompactListList/Test-CompactListList.C
index 9baf498faf2d50cbe3a37e1436651620c6b9d792..265bb7646ffb413d078943df55b9722caa0500c5 100644
--- a/applications/test/CompactListList/Test-CompactListList.C
+++ b/applications/test/CompactListList/Test-CompactListList.C
@@ -31,8 +31,7 @@ Description
 
 #include "CompactListList.H"
 #include "IOstreams.H"
-#include "OStringStream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "faceList.H"
 
 using namespace Foam;
diff --git a/applications/test/HashTable/Test-hashTable.C b/applications/test/HashTable/Test-hashTable.C
index 5dd3ca0fa4ec675b7b1a7fb3de879efe5a0e830f..1071b0a473af0b2040d711f79f13abb92f1e731c 100644
--- a/applications/test/HashTable/Test-hashTable.C
+++ b/applications/test/HashTable/Test-hashTable.C
@@ -29,8 +29,7 @@ License
 #include "DynamicList.H"
 #include "FlatOutput.H"
 #include "IOstreams.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/test/IStringStream/Test-IStringStream.C b/applications/test/IStringStream/Test-IStringStream.C
index 8c35bbaa33bbab32ff4462287ac0887cd37f17ba..cd8ba0e2a6165cba7df6db65c52fb59aa27e2874 100644
--- a/applications/test/IStringStream/Test-IStringStream.C
+++ b/applications/test/IStringStream/Test-IStringStream.C
@@ -25,7 +25,7 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "wordList.H"
 #include "IOstreams.H"
 
diff --git a/applications/test/List/Test-List.C b/applications/test/List/Test-List.C
index d68bc4d7baa108673feab7951d386b3904a09317..5d3f3ba4b49c840ecf6b835b9b3b398a325a6767 100644
--- a/applications/test/List/Test-List.C
+++ b/applications/test/List/Test-List.C
@@ -37,7 +37,7 @@ See also
 #include "wordReList.H"
 
 #include "IOstreams.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "scalar.H"
 #include "vector.H"
 
diff --git a/applications/test/OStringStream/Test-OStringStream.C b/applications/test/OStringStream/Test-OStringStream.C
index 313f108149b1c786e3f56715533ff3d5d63b980e..28e3861e470e2e019bc11dbab2519efcfc95ae44 100644
--- a/applications/test/OStringStream/Test-OStringStream.C
+++ b/applications/test/OStringStream/Test-OStringStream.C
@@ -25,8 +25,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#include "OStringStream.H"
 #include "IOstreams.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
@@ -35,15 +35,28 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
-    Info<< "khkj" << endl;
-
-    OStringStream testStream;
-    testStream << "hello " << 1 << endl;
-    Info<< testStream.str() << endl;
-    testStream.rewind();
-    Info<< testStream.str() << endl;
-    testStream << "hello " << 2 << endl;
-    Info<< testStream.str() << endl;
+    Info<< "Begin test OStringStream" << endl;
+
+    OStringStream os;
+    os << "output with some values " << 1 << " entry" << endl;
+
+    Info<< "contains:" << nl
+        << os.str() << endl;
+    os.rewind();
+
+    Info<< "after rewind:" << nl
+        << os.str() << endl;
+
+    os << "####";
+
+    Info<< "overwrite with short string:" << nl
+        << os.str() << endl;
+
+    os.reset();
+    os << "%%%% reset";
+
+    Info<< "after reset:" << nl
+        << os.str() << endl;
 
     Info<< "End\n" << endl;
 
diff --git a/applications/test/PackedList4/Test-PackedList4.C b/applications/test/PackedList4/Test-PackedList4.C
index 6d284a339bffc6fcd433e3f5db7aa943d9d1960b..ee85d62985426c2f5db9aeb8eceb47c28d77325e 100644
--- a/applications/test/PackedList4/Test-PackedList4.C
+++ b/applications/test/PackedList4/Test-PackedList4.C
@@ -30,7 +30,7 @@ Description
 #include "uLabel.H"
 #include "IOstreams.H"
 #include "PackedBoolList.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/test/Polynomial/Test-Polynomial.C b/applications/test/Polynomial/Test-Polynomial.C
index 6a6fb8bb455bf7ecab4c226bf91bc34197df551a..996d519f6a331cd576444dfd0153094d7a76a0e3 100644
--- a/applications/test/Polynomial/Test-Polynomial.C
+++ b/applications/test/Polynomial/Test-Polynomial.C
@@ -29,7 +29,7 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "Polynomial.H"
 #include "polynomialFunction.H"
 #include "Random.H"
diff --git a/applications/test/StaticHashTable/Test-staticHashTable.C b/applications/test/StaticHashTable/Test-staticHashTable.C
index 7a0bf9b27ea3d32ecf45cccbcab5f708fc3e017d..c21e6597debda0bc95cf1e5be8501da9fcf42eb9 100644
--- a/applications/test/StaticHashTable/Test-staticHashTable.C
+++ b/applications/test/StaticHashTable/Test-staticHashTable.C
@@ -25,8 +25,7 @@ License
 
 #include "StaticHashTable.H"
 #include "IOstreams.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/test/error/Test-error.C b/applications/test/error/Test-error.C
index b9be1924a523b7058ec8e19685e150b2193d3b12..981e071b8fe2e82dc0e1d3229e918826d55784c0 100644
--- a/applications/test/error/Test-error.C
+++ b/applications/test/error/Test-error.C
@@ -47,8 +47,24 @@ int main(int argc, char *argv[])
 
         IOWarningInFunction(dict) << "warning 3" << endl;
 
-        FatalErrorInFunction << "error 1" << endl;
-        FatalErrorInFunction << "error 2" << exit(FatalError);
+        FatalErrorInFunction
+            << "This is an error from 1" << nl
+            << "Explanation to follow:" << endl;
+
+        FatalErrorInFunction
+            << "Error 2"
+            << exit(FatalError);
+    }
+    catch (Foam::error& fErr)
+    {
+        Serr<< "Caught Foam error " << fErr << nl << endl;
+    }
+
+    try
+    {
+        FatalErrorInFunction
+            << "Error# 3"
+            << exit(FatalError);
     }
     catch (Foam::error& fErr)
     {
diff --git a/applications/test/findCell-octree/Test-findCell-octree.C b/applications/test/findCell-octree/Test-findCell-octree.C
index 1bac7302a02ecee1bf0e68c98d9777b2abc47d3c..1772a838f2501ba72d9980351a78c0fa30fc4499 100644
--- a/applications/test/findCell-octree/Test-findCell-octree.C
+++ b/applications/test/findCell-octree/Test-findCell-octree.C
@@ -26,7 +26,6 @@ License
 #include "argList.H"
 #include "Time.H"
 #include "fvMesh.H"
-#include "IStringStream.H"
 #include "indexedOctree.H"
 #include "treeDataCell.H"
 #include "OFstream.H"
diff --git a/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C b/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C
index 0c2f95429ded138c6cab39bdf352d0b240facdf5..f616b3a48cd9d2f0521d50900cb3f6e421ff93dc 100644
--- a/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C
+++ b/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C
@@ -26,7 +26,6 @@ License
 #include "argList.H"
 #include "Time.H"
 #include "fvMesh.H"
-#include "IStringStream.H"
 #include "indexedOctree.H"
 #include "treeDataEdge.H"
 #include "OFstream.H"
diff --git a/applications/test/globalIndex/Test-globalIndex.C b/applications/test/globalIndex/Test-globalIndex.C
index 0834534952b6a327428804c85e8d847df11886f4..51efc7a5efd996392436f16d45c0d306fb9ab55a 100644
--- a/applications/test/globalIndex/Test-globalIndex.C
+++ b/applications/test/globalIndex/Test-globalIndex.C
@@ -34,8 +34,6 @@ Description
 #include "Time.H"
 #include "polyMesh.H"
 #include "IOstreams.H"
-#include "OStringStream.H"
-#include "IStringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/test/prefixOSstream/Test-prefixOSstream.C b/applications/test/prefixOSstream/Test-prefixOSstream.C
index accaf914e0ba20709e700902a46babe66baff3ea..363b4ccd3bebe3329fb70bfecba86d48848de532 100644
--- a/applications/test/prefixOSstream/Test-prefixOSstream.C
+++ b/applications/test/prefixOSstream/Test-prefixOSstream.C
@@ -31,7 +31,6 @@ Description
 #include "OSspecific.H"
 
 #include "IOstreams.H"
-#include "IStringStream.H"
 #include "scalar.H"
 #include "vector.H"
 #include "ListOps.H"
@@ -49,31 +48,26 @@ int main(int argc, char *argv[])
 
     //Pout.prefix() = '[' + name(Pstream::myProcNo()) + "] ";
 
-    List<vector> list(IStringStream("1 ((0 1 2))")());
+    List<vector> list{{0, 1, 2}};
     Info<< list << endl;
 
     List<vector> list2
-    (
-        IStringStream
-        (
-            "(\
-                 (0 1 2)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-                 (3 4 5)\
-             )"
-        )()
-    );
+    {
+        {0, 1, 2},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+        {3, 4, 5},
+    };
     Pout<< list2 << endl;
 
     Info<< findIndex(list2, vector(3, 4, 5)) << endl;
diff --git a/applications/test/router/Test-processorRouter.C b/applications/test/router/Test-processorRouter.C
index f5411c062725cebea44b2fa71e6789727b0ec3f0..48fc4ab61b102a26e41999583387b62f960fa48e 100644
--- a/applications/test/router/Test-processorRouter.C
+++ b/applications/test/router/Test-processorRouter.C
@@ -28,10 +28,8 @@ Description
 #include "argList.H"
 #include "label.H"
 #include "labelList.H"
-#include "OStringStream.H"
-#include "IStringStream.H"
-#include "OFstream.H"
 #include "IFstream.H"
+#include "OFstream.H"
 #include "point.H"
 #include "Time.H"
 #include "fvMesh.H"
diff --git a/applications/test/sha1/Test-SHA1.C b/applications/test/sha1/Test-SHA1.C
index 4d81dc8148827a08f22b68911753ab480550b7a8..03062d8596f8e9bdd86a2ea1c6a812eb9da91195 100644
--- a/applications/test/sha1/Test-SHA1.C
+++ b/applications/test/sha1/Test-SHA1.C
@@ -30,7 +30,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "OSHA1stream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "dictionary.H"
 
 using namespace Foam;
@@ -96,7 +96,7 @@ int main(int argc, char * argv[])
         os  << str;
         Info<< os.digest() << endl;
 
-        os.rewind();
+        os.reset();
         os  << "The quick brown fox jumps over the lazy dog";
         Info<< os.digest() << endl;
     }
diff --git a/applications/test/sizeof/Test-sizeof.C b/applications/test/sizeof/Test-sizeof.C
index ed5390453b1aa89551bcb4f3b7fca8fe98e36728..a884d87fde936261a0bc8dade24510610ccdb814 100644
--- a/applications/test/sizeof/Test-sizeof.C
+++ b/applications/test/sizeof/Test-sizeof.C
@@ -32,7 +32,6 @@ Description
 #include "dictionary.H"
 #include "nil.H"
 #include "IOstreams.H"
-#include "IStringStream.H"
 
 namespace Foam
 {
diff --git a/applications/test/stringList/Test-stringList.C b/applications/test/stringList/Test-stringList.C
index 8fb09e7392e3bcac51173d78cb7a690ffc404cdd..f4ea77f0624747ed67e633185cd4285d2fc3adbc 100644
--- a/applications/test/stringList/Test-stringList.C
+++ b/applications/test/stringList/Test-stringList.C
@@ -26,8 +26,8 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "stringListOps.H"
-#include "IStringStream.H"
 #include "IOstreams.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
@@ -37,22 +37,17 @@ using namespace Foam;
 int main(int argc, char *argv[])
 {
     stringList strLst
-    (
-        IStringStream
-        (
-            "("
-            "\"hello\""
-            "\"heello\""
-            "\"heeello\""
-            "\"bye\""
-            "\"bbye\""
-            "\"bbbye\""
-            "\"okey\""
-            "\"okkey\""
-            "\"okkkey\""
-            ")"
-        )()
-    );
+    {
+        "hello",
+        "heello",
+        "heeello",
+        "bye",
+        "bbye",
+        "bbbye",
+        "okey",
+        "okkey",
+        "okkkey",
+    };
 
     wordReList reLst(IStringStream("( okey \"[hy]e+.*\" )")());
 
diff --git a/applications/test/tokenize/Test-tokenize.C b/applications/test/tokenize/Test-tokenize.C
index 8c099f9afc0d218519de7de6368fc822218e5120..bd2f84a4820580915d6a71c308aa2f55050e7c0b 100644
--- a/applications/test/tokenize/Test-tokenize.C
+++ b/applications/test/tokenize/Test-tokenize.C
@@ -31,7 +31,7 @@ Description
 #include "IOobject.H"
 #include "IOstreams.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "cpuTime.H"
 
 using namespace Foam;
@@ -41,22 +41,28 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
+    argList::noBanner();
     argList::noParallel();
     argList::validArgs.insert("string .. stringN");
     argList::addOption("file", "name");
     argList::addOption("repeat", "count");
+    argList::addBoolOption("verbose", "report for each repeat");
 
     argList args(argc, argv, false, true);
 
     const label repeat = args.optionLookupOrDefault<label>("repeat", 1);
 
+    const bool optVerbose = args.optionFound("verbose");
+
     cpuTime timer;
     for (label count = 0; count < repeat; ++count)
     {
+        const bool verbose = (optVerbose || count == 0);
+
         for (label argI=1; argI < args.size(); ++argI)
         {
             const string& rawArg = args[argI];
-            if (count == 0)
+            if (verbose)
             {
                 Info<< "input string: " << rawArg << nl;
             }
@@ -71,14 +77,15 @@ int main(int argc, char *argv[])
                 // is.putback(ch);
                 int lookahead = is.peek();
 
-                if (count == 0)
+                if (verbose)
                 {
-                    Info<< "token: " << tok.info();
-                    Info<< "  lookahead: '" << char(lookahead) << "'" << endl;
+                    Info<< "token: " << tok.info()
+                        << "  lookahead: '" << char(lookahead) << "'"
+                        << endl;
                 }
             }
 
-            if (count == 0)
+            if (verbose)
             {
                 Info<< nl;
                 IOobject::writeDivider(Info);
@@ -89,31 +96,44 @@ int main(int argc, char *argv[])
     Info<< "tokenized args " << repeat << " times in "
         << timer.cpuTimeIncrement() << " s\n\n";
 
-    if (args.optionFound("file"))
+    fileName inputFile;
+    if (args.optionReadIfPresent("file", inputFile))
     {
+        IFstream is(inputFile);
+
         for (label count = 0; count < repeat; ++count)
         {
-            IFstream is(args["file"]);
+            const bool verbose = (optVerbose || count == 0);
+            label nTokens = 0;
 
-            if (count == 0)
+            if (count)
             {
-                Info<< "tokenizing file: " << args["file"] << nl;
+                is.rewind();
             }
 
+            Info<< nl
+                << "tokenizing file (pass #" << (count+1) << ") "
+                << inputFile << nl
+                << "state: " << is.info() << endl;
+
             while (is.good())
             {
                 token tok(is);
-                if (count == 0)
+                if (verbose)
                 {
                     Info<< "token: " << tok.info() << endl;
                 }
+                ++nTokens;
             }
 
-            if (count == 0)
+            if (verbose)
             {
                 Info<< nl;
                 IOobject::writeDivider(Info);
             }
+
+            Info<<"pass #" << (count+1)
+                << " extracted " << nTokens << " tokens" << endl;
         }
 
         Info<< "tokenized file " << repeat << " times in "
diff --git a/applications/test/xfer/Test-xferList.C b/applications/test/xfer/Test-xferList.C
index 9b800220ca72788ff8563d190883e567ba62d2da..897e4270724bbfae63f792a7190d46a6e8faa6c3 100644
--- a/applications/test/xfer/Test-xferList.C
+++ b/applications/test/xfer/Test-xferList.C
@@ -30,7 +30,6 @@ Description
 #include "OSspecific.H"
 
 #include "IOstreams.H"
-#include "IStringStream.H"
 #include "labelList.H"
 #include "DynamicList.H"
 #include "face.H"
diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
index 3268db210812a2ae543023e0c3c10e618aaf2ac3..6982f4bc94c4602255764c885ba74bffb00bf5fe 100644
--- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
+++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
@@ -46,7 +46,7 @@ Description
 #include <cstdio>
 
 #include "scalar.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
@@ -271,7 +271,6 @@ elementType           ^{space}"TYPE"{cspace}
 
 #include "fileName.H"
 #include <fstream>
-using std::ifstream;
 
 
 label findFace(const polyMesh& mesh, const face& f)
@@ -318,8 +317,8 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    fileName ansysFile(args[1]);
-    ifstream ansysStream(ansysFile.c_str());
+    const fileName ansysFile(args[1]);
+    std::ifstream ansysStream(ansysFile);
 
     if (!ansysStream)
     {
diff --git a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
index 06564cd80fa6c5d3025937d0e1a27c5c47f1391a..11255ced731357992a2f1afc458b1594fa386f25 100644
--- a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
+++ b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    std::ifstream plot3dFile(args[1].c_str());
+    std::ifstream plot3dFile(args[1]);
 
     string line;
     std::getline(plot3dFile, line);
diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
index 7d8889ed380ff152a3b4c71ec90b8c4dd0b9cfbf..527d7e368c49b501adbec0adf28cb09304866556 100644
--- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
@@ -43,7 +43,7 @@ Description
 
 #include "argList.H"
 #include "Time.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "polyMesh.H"
 #include "emptyPolyPatch.H"
 #include "wallPolyPatch.H"
@@ -906,7 +906,7 @@ int main(int argc, char *argv[])
     #include "createTime.H"
 
     const fileName fluentFile = args[1];
-    std::ifstream fluentStream(fluentFile.c_str());
+    std::ifstream fluentStream(fluentFile);
 
     if (!fluentStream)
     {
diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C
index e86ba6c41719af6b9340a40b0723391e42f83fb2..ac632fc8d86c2d5edebedd981b4d4cbcc552edd5 100644
--- a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C
+++ b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C
@@ -26,7 +26,6 @@ License
 #include <fstream>
 #include <iostream>
 
-using std::ofstream;
 using std::ios;
 
 #include "Time.H"
@@ -49,18 +48,16 @@ Foam::fluentFvMesh::fluentFvMesh(const IOobject& io)
 
 void Foam::fluentFvMesh::writeFluentMesh() const
 {
-    // make a directory called proInterface in the case
+    // Make a directory called fluentInterface in the case
     mkDir(time().rootPath()/time().caseName()/"fluentInterface");
 
-    // open a file for the mesh
-    ofstream fluentMeshFile
+    // Open a file for the mesh
+    std::ofstream fluentMeshFile
     (
-        (
-            time().rootPath()/
-            time().caseName()/
-            "fluentInterface"/
-            time().caseName() + ".msh"
-        ).c_str()
+        time().rootPath()
+      / time().caseName()
+      / "fluentInterface"
+      / time().caseName() + ".msh"
     );
 
     Info<< "Writing Header" << endl;
diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
index ff3ae5737ed1c82f273fd9295ba6ea8fe51113c3..6db26071d55f2c13893ee87f9814555e74ca78cd 100644
--- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
+++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
@@ -41,7 +41,7 @@ Description
  \* ------------------------------------------------------------------------- */
 
 #include "scalarList.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // For EOF only
 #include <cstdio>
@@ -622,7 +622,6 @@ mtype                 {space}"MTYPE:"{space}
 
 #include "fileName.H"
 #include <fstream>
-using std::ifstream;
 
 int main(int argc, char *argv[])
 {
@@ -647,7 +646,7 @@ int main(int argc, char *argv[])
     #include "createTime.H"
 
     const fileName gambitFile = args[1];
-    ifstream gambitStream(gambitFile.c_str());
+    std::ifstream gambitStream(gambitFile);
 
     if (!gambitStream)
     {
diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
index 8db1bdfec82f37b9d67ab784f861c1818fb4b695..e97a717f0346229e59a86efacb1de10f07b56ed2 100644
--- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
+++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
@@ -1,4 +1,4 @@
-ifstream kivaFile(kivaFileName.c_str());
+std::ifstream kivaFile(kivaFileName);
 
 if (!kivaFile.good())
 {
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C
index 13a137f694db1cc2c4dd281e370cd58c7223aaae..ef1b8917a0d5a7c27717f2367658f27d41e88b2b 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C
@@ -27,8 +27,7 @@ License
 #include "point.H"
 #include "Istream.H"
 #include "Ostream.H"
-#include "OStringStream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * *  IOStream operators * * * * * * * * * * * //
 
diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
index 198ca435d6dc0c8454ab52456a2f5fdc29638d2e..c60a11e2856e8d4a58142056b9a134d68821296c 100644
--- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
+++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
@@ -36,7 +36,6 @@ Description
 #include "argList.H"
 #include "fvMesh.H"
 #include "pointFields.H"
-#include "IStringStream.H"
 #include "volPointInterpolation.H"
 
 using namespace Foam;
diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
index 7b61f097cfa63a43de80d40131b56f2da9c77370..16b234d1f61cfdd52369d492dcbf21c6efa91953 100644
--- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
+++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
@@ -34,16 +34,12 @@ Description
 
 #include "argList.H"
 #include "OFstream.H"
-#include <fstream>
-#include <sstream>
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "point.H"
 #include "DynamicList.H"
 
-
 using namespace Foam;
 
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 string getLine(std::ifstream& is)
@@ -122,7 +118,7 @@ int main(int argc, char *argv[])
     const fileName objName = args[1];
     const fileName outName = args[2];
 
-    std::ifstream OBJfile(objName.c_str());
+    std::ifstream OBJfile(objName);
 
     if (!OBJfile.good())
     {
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 8ce92fc9b752a4443d0a3739ea643f1c128afd99..4a64e6f8011ac8df4f6e87a7503aa172d045152d 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -36,7 +36,7 @@ Description
 #include "Time.H"
 #include "polyMesh.H"
 #include "globalMeshData.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "cellSet.H"
 #include "faceSet.H"
 #include "pointSet.H"
diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
index 23ac90868c31d455014f1bfaaef39ef54213410b..2b30a5d7fa2ae2b39895b2e0b7eada8aa83e92d3 100644
--- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
+++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
@@ -46,12 +46,9 @@ Description
 #include "argList.H"
 #include "Time.H"
 #include "polyMesh.H"
-#include "IStringStream.H"
 #include "cellSet.H"
 #include "faceSet.H"
 #include "pointSet.H"
-#include "OFstream.H"
-#include "IFstream.H"
 #include "IOobjectList.H"
 #include "SortableList.H"
 #include "timeSelector.H"
diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
index 751e70934dc85a7e945a799f117b296312a55012..db2f571043f341e16f44c8b2bfb2e7a81153faac 100644
--- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
+++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
@@ -68,7 +68,7 @@ Usage
 #include "pointFields.H"
 #include "transformField.H"
 #include "transformGeometricField.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "mathematicalConstants.H"
 
 using namespace Foam;
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
index 70ccb1f42067c5a509ced280f7b6be1663a715b4..6a9037c38540e54f51f46a3ed603652210c35b1e 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
@@ -31,7 +31,7 @@ License
 #include "blockMeshTools.H"
 #include "Time.H"
 #include "patchZones.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // VTK includes
 #include "vtkDataArraySelection.h"
diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C
index 77381e362e0f582847137478a8d78e42cf977892..983ba7474fe7729fb7e1a570537d156947363979 100644
--- a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C
+++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C
@@ -26,7 +26,7 @@ License
 #include "boundaryTemplates.H"
 #include "Time.H"
 #include "IFstream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
index abdeec1c89fa66a0cc7a2bf492c60da9686dee07..2db1c32b11457dd3669765b41523b879f8e424c5 100644
--- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
+++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
@@ -71,8 +71,7 @@ Note
 #include "ModifiableMeshedSurface.H"
 #include "UnsortedMeshedSurfaces.H"
 
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
index 4ae601829e8730ea0a298e42d4ef5fc7fc09edbe..b7f7c9d7b189eea251d41d92cb0e259220bd8e44 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
+++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
@@ -36,8 +36,7 @@ Description
 #include "argList.H"
 #include "chemkinReader.H"
 #include "OFstream.H"
-#include "OStringStream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 using namespace Foam;
 
diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C
index 3fbc3b2684c192ab91281121f04337183064f9fc..d9b2e0b3a4da62f726d643eb374d36e0b7d12e10 100644
--- a/src/OSspecific/POSIX/POSIX.C
+++ b/src/OSspecific/POSIX/POSIX.C
@@ -724,13 +724,13 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
         }
 
         // Open and check streams.
-        std::ifstream srcStream(src.c_str());
+        std::ifstream srcStream(src);
         if (!srcStream)
         {
             return false;
         }
 
-        std::ofstream destStream(destFile.c_str());
+        std::ofstream destStream(destFile);
         if (!destStream)
         {
             return false;
diff --git a/src/OSspecific/POSIX/printStack.C b/src/OSspecific/POSIX/printStack.C
index 660f82daebcdb19b70696f8eaef25faa9eb1d3e3..bee02686b3613b0d6ba3fe72082bb5e13d3524f8 100644
--- a/src/OSspecific/POSIX/printStack.C
+++ b/src/OSspecific/POSIX/printStack.C
@@ -24,9 +24,9 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-#include "OStringStream.H"
 #include "OSspecific.H"
 #include "IFstream.H"
+#include "StringStream.H"
 
 #include <inttypes.h>
 #include <cxxabi.h>
@@ -55,7 +55,7 @@ string pOpen(const string &cmd, label line=0)
         {
             size_t linecap = 0;
             ssize_t linelen;
-            linelen = getline(&buf, &linecap, cmdPipe);
+            linelen = ::getline(&buf, &linecap, cmdPipe);
 
             if (linelen < 0)
             {
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index 91781cff7c8659635fb4735ee8c6d91cdaa331a3..dba68b7a11a50f280dd8d40094039ee5c9688900 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -171,7 +171,7 @@ Tstreams = $(Streams)/Tstreams
 $(Tstreams)/ITstream.C
 
 StringStreams = $(Streams)/StringStreams
-$(StringStreams)/StringStreamsPrint.C
+$(StringStreams)/StringStream.C
 
 Pstreams = $(Streams)/Pstreams
 $(Pstreams)/UIPstream.C
diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/Fstream.H b/src/OpenFOAM/db/IOstreams/Fstreams/Fstream.H
new file mode 100644
index 0000000000000000000000000000000000000000..2bd3ff850d3c382bb8e0a4806cc60c56fbc44c3e
--- /dev/null
+++ b/src/OpenFOAM/db/IOstreams/Fstreams/Fstream.H
@@ -0,0 +1,40 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+InClass
+    Foam::Fstream
+
+Description
+    Input/output from file streams.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Fstream_H
+#define Fstream_H
+
+#include "IFstream.H"
+#include "OFstream.H"
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C
index f48aa9982b3e7d08089e98c81eac011fbc8d3839..fd3889618ea47660ed761cb72e81277653730c61 100644
--- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C
+++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -35,11 +35,11 @@ namespace Foam
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
 :
-    ifPtr_(nullptr),
+    allocatedPtr_(nullptr),
     compression_(IOstream::UNCOMPRESSED)
 {
     if (pathname.empty())
@@ -50,21 +50,21 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
         }
     }
 
-    ifPtr_ = new ifstream(pathname.c_str());
+    allocatedPtr_ = new std::ifstream(pathname);
 
     // If the file is compressed, decompress it before reading.
-    if (!ifPtr_->good() && isFile(pathname + ".gz", false))
+    if (!allocatedPtr_->good() && isFile(pathname + ".gz", false))
     {
         if (IFstream::debug)
         {
             InfoInFunction << "Decompressing " << pathname + ".gz" << endl;
         }
 
-        delete ifPtr_;
+        delete allocatedPtr_;
 
-        ifPtr_ = new igzstream((pathname + ".gz").c_str());
+        allocatedPtr_ = new igzstream((pathname + ".gz").c_str());
 
-        if (ifPtr_->good())
+        if (allocatedPtr_->good())
         {
             compression_ = IOstream::COMPRESSED;
         }
@@ -72,9 +72,23 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
 }
 
 
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
 Foam::IFstreamAllocator::~IFstreamAllocator()
 {
-    delete ifPtr_;
+    deallocate();
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::IFstreamAllocator::deallocate()
+{
+    if (allocatedPtr_)
+    {
+        delete allocatedPtr_;
+        allocatedPtr_ = nullptr;
+    }
 }
 
 
@@ -90,7 +104,7 @@ Foam::IFstream::IFstream
     IFstreamAllocator(pathname),
     ISstream
     (
-        *ifPtr_,
+        *allocatedPtr_,
         pathname,
         format,
         version,
@@ -99,14 +113,15 @@ Foam::IFstream::IFstream
 {
     setClosed();
 
-    setState(ifPtr_->rdstate());
+    setState(allocatedPtr_->rdstate());
 
     if (!good())
     {
         if (debug)
         {
             InfoInFunction
-                << "Could not open file for input" << endl << info() << endl;
+                << "Could not open file " << pathname
+                << " for input" << nl << info() << Foam::endl;
         }
 
         setBad();
@@ -130,29 +145,63 @@ Foam::IFstream::~IFstream()
 
 std::istream& Foam::IFstream::stdStream()
 {
-    if (!ifPtr_)
+    if (!allocatedPtr_)
     {
         FatalErrorInFunction
-            << "No stream allocated" << abort(FatalError);
+            << "No stream allocated"
+            << abort(FatalError);
     }
-    return *ifPtr_;
+    return *allocatedPtr_;
 }
 
 
 const std::istream& Foam::IFstream::stdStream() const
 {
-    if (!ifPtr_)
+    if (!allocatedPtr_)
     {
         FatalErrorInFunction
-            << "No stream allocated" << abort(FatalError);
+            << "No stream allocated"
+            << abort(FatalError);
+    }
+    return *allocatedPtr_;
+}
+
+
+Foam::Istream& Foam::IFstream::rewind()
+{
+    lineNumber_ = 1;      // Reset line number
+
+    igzstream* gzPtr = nullptr;
+
+    try
+    {
+        gzPtr = dynamic_cast<igzstream*>(allocatedPtr_);
+    }
+    catch (std::bad_cast)
+    {
+        gzPtr = nullptr;
+    }
+
+    if (gzPtr)
+    {
+        // Need special treatment for gzstream.
+        gzPtr->close();
+        gzPtr->clear();
+        gzPtr->open((this->name() + ".gz").c_str());
+
+        setState(gzPtr->rdstate());
     }
-    return *ifPtr_;
+    else
+    {
+        ISstream::rewind();
+    }
+
+    return *this;
 }
 
 
 void Foam::IFstream::print(Ostream& os) const
 {
-    // Print File data
     os  << "IFstream: ";
     ISstream::print(os);
 }
@@ -164,10 +213,10 @@ Foam::IFstream& Foam::IFstream::operator()() const
 {
     if (!good())
     {
-        // also checks .gz file
+        // Also checks .gz file
         if (isFile(this->name(), true))
         {
-            check("IFstream::operator()");
+            check(FUNCTION_NAME);
             FatalIOError.exit();
         }
         else
diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H
index b2280d70ae11bee9b67e1c6897cb39dc3b2584d3..72f89873c58a92447f7de8320ceac5609d0ee7d5 100644
--- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H
+++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,7 +25,7 @@ Class
     Foam::IFstream
 
 Description
-    Input from file stream.
+    Input from file stream, using a ISstream
 
 SourceFiles
     IFstream.C
@@ -47,20 +47,21 @@ using std::ifstream;
 namespace Foam
 {
 
-class IFstream;
-
 /*---------------------------------------------------------------------------*\
                       Class IFstreamAllocator Declaration
 \*---------------------------------------------------------------------------*/
 
-//- A std::istream with ability to handle compressed files
+//- A std::istream with the ability to handle compressed files
 class IFstreamAllocator
 {
-    friend class IFstream;
+protected:
+
+    // Member Data
 
-    // Private data
+        //- The allocated stream pointer (ifstream or igzstream).
+        std::istream* allocatedPtr_;
 
-        istream* ifPtr_;
+        //- The requested compression type
         IOstream::compressionType compression_;
 
 
@@ -72,6 +73,13 @@ class IFstreamAllocator
 
     //- Destructor
     ~IFstreamAllocator();
+
+
+    // Protected Member Functions
+
+        //- Delete the stream pointer
+        void deallocate();
+
 };
 
 
@@ -105,27 +113,30 @@ public:
     ~IFstream();
 
 
-    // Member functions
+    // Member Functions
+
+      // Access
 
-        // Access
+        //- Read/write access to the name of the stream
+        using ISstream::name;
 
-            //- Read/write access to the name of the stream
-            using ISstream::name;
 
+      // STL stream
 
-        // STL stream
+        //- Access to underlying std::istream
+        virtual std::istream& stdStream();
 
-            //- Access to underlying std::istream
-            virtual istream& stdStream();
+        //- Const access to underlying std::istream
+        virtual const std::istream& stdStream() const;
 
-            //- Const access to underlying std::istream
-            virtual const istream& stdStream() const;
+        //- Rewind the stream so that it may be read again
+        virtual Istream& rewind();
 
 
-        // Print
+      // Print
 
-            //- Print description of IOstream to Ostream
-            virtual void print(Ostream&) const;
+        //- Print description of IOstream to Ostream
+        virtual void print(Ostream& os) const;
 
 
     // Member operators
diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C
index 384d40dfcee79271db785a93a21a52b63bf511f2..aad480a105a2d038b80ded2733c1d06e05fd1588 100644
--- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C
+++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -43,7 +43,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
     IOstream::compressionType compression
 )
 :
-    ofPtr_(nullptr)
+    allocatedPtr_(nullptr)
 {
     if (pathname.empty())
     {
@@ -55,30 +55,40 @@ Foam::OFstreamAllocator::OFstreamAllocator
 
     if (compression == IOstream::COMPRESSED)
     {
-        // get identically named uncompressed version out of the way
+        // Get identically named uncompressed version out of the way
         if (isFile(pathname, false))
         {
             rm(pathname);
         }
 
-        ofPtr_ = new ogzstream((pathname + ".gz").c_str());
+        allocatedPtr_ = new ogzstream((pathname + ".gz").c_str());
     }
     else
     {
-        // get identically named compressed version out of the way
+        // Get identically named compressed version out of the way
         if (isFile(pathname + ".gz", false))
         {
             rm(pathname + ".gz");
         }
 
-        ofPtr_ = new ofstream(pathname.c_str());
+        allocatedPtr_ = new std::ofstream(pathname);
     }
 }
 
 
 Foam::OFstreamAllocator::~OFstreamAllocator()
 {
-    delete ofPtr_;
+    deallocate();
+}
+
+
+void Foam::OFstreamAllocator::deallocate()
+{
+    if (allocatedPtr_)
+    {
+        delete allocatedPtr_;
+        allocatedPtr_ = nullptr;
+    }
 }
 
 
@@ -93,10 +103,10 @@ Foam::OFstream::OFstream
 )
 :
     OFstreamAllocator(pathname, compression),
-    OSstream(*ofPtr_, pathname, format, version, compression)
+    OSstream(*allocatedPtr_, pathname, format, version, compression)
 {
     setClosed();
-    setState(ofPtr_->rdstate());
+    setState(allocatedPtr_->rdstate());
 
     if (!good())
     {
@@ -104,8 +114,7 @@ Foam::OFstream::OFstream
         {
             InfoInFunction
                 << "Could not open file " << pathname
-                << "for input\n"
-                   "in stream " << info() << Foam::endl;
+                << " for output" << nl << info() << Foam::endl;
         }
 
         setBad();
@@ -129,29 +138,29 @@ Foam::OFstream::~OFstream()
 
 std::ostream& Foam::OFstream::stdStream()
 {
-    if (!ofPtr_)
+    if (!allocatedPtr_)
     {
         FatalErrorInFunction
             << "No stream allocated." << abort(FatalError);
     }
-    return *ofPtr_;
+    return *allocatedPtr_;
 }
 
 
 const std::ostream& Foam::OFstream::stdStream() const
 {
-    if (!ofPtr_)
+    if (!allocatedPtr_)
     {
         FatalErrorInFunction
             << "No stream allocated." << abort(FatalError);
     }
-    return *ofPtr_;
+    return *allocatedPtr_;
 }
 
 
 void Foam::OFstream::print(Ostream& os) const
 {
-    os  << "    OFstream: ";
+    os  << "OFstream: ";
     OSstream::print(os);
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H
index 6601fcd53c00f09af96850d54f30921410f79b42..84487809d25366c372f33b7b6dc6a7b038c09111 100644
--- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H
+++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,7 +25,7 @@ Class
     Foam::OFstream
 
 Description
-    Output to file stream.
+    Output to file stream, using a OSstream
 
 SourceFiles
     OFstream.C
@@ -47,18 +47,20 @@ using std::ofstream;
 namespace Foam
 {
 
-class OFstream;
-
 /*---------------------------------------------------------------------------*\
                       Class OFstreamAllocator Declaration
 \*---------------------------------------------------------------------------*/
 
-//- A std::ostream with ability to handle compressed files
+//- A std::ostream with the ability to handle compressed files
 class OFstreamAllocator
 {
-    friend class OFstream;
+protected:
+
+    // Member Data
+
+        //- The allocated stream pointer (ofstream or ogzstream).
+        std::ostream* allocatedPtr_;
 
-    ostream* ofPtr_;
 
     // Constructors
 
@@ -69,9 +71,16 @@ class OFstreamAllocator
             IOstream::compressionType compression=IOstream::UNCOMPRESSED
         );
 
+
     //- Destructor
     ~OFstreamAllocator();
 
+
+    // Protected Member Functions
+
+        //- Delete the stream pointer
+        void deallocate();
+
 };
 
 
@@ -81,7 +90,7 @@ class OFstreamAllocator
 
 class OFstream
 :
-    private OFstreamAllocator,
+    public OFstreamAllocator,
     public OSstream
 {
 public:
@@ -108,25 +117,25 @@ public:
 
     // Member functions
 
-        // Access
+      // Access
 
-            //- Read/write access to the name of the stream
-            using OSstream::name;
+        //- Read/write access to the name of the stream
+        using OSstream::name;
 
 
-        // STL stream
+      // STL stream
 
-            //- Access to underlying std::ostream
-            virtual ostream& stdStream();
+        //- Access to underlying std::ostream
+        virtual std::ostream& stdStream();
 
-            //- Const access to underlying std::ostream
-            virtual const ostream& stdStream() const;
+        //- Const access to underlying std::ostream
+        virtual const std::ostream& stdStream() const;
 
 
-        // Print
+      // Print
 
-            //- Print description of IOstream to Ostream
-            void print(Ostream&) const;
+        //- Print description of IOstream to Ostream
+        void print(Ostream& os) const;
 };
 
 
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C
index 94cf60f4fb25151d105b00ea6d5ef085c3a2ab07..7bd031d87a49e4a8ea70fa85971aeaed675e2359 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C
@@ -799,7 +799,13 @@ Foam::Istream& Foam::ISstream::read(char* buf, std::streamsize count)
 
 Foam::Istream& Foam::ISstream::rewind()
 {
-    stdStream().rdbuf()->pubseekpos(0);
+    lineNumber_ = 1;      // Reset line number
+
+    stdStream().clear();  // Clear the iostate error state flags
+    setGood();            // Sync local copy of iostate
+
+    // pubseekpos() rather than seekg() so that it works with gzstream
+    stdStream().rdbuf()->pubseekpos(0, std::ios_base::in);
 
     return *this;
 }
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H
index b77f79ed13a6e5413e7080624f41614f2dbc5533..18890e208734385fb266bfb9aec79d5039c8ac6e 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H
@@ -56,23 +56,23 @@ class ISstream
     // Private data
 
         fileName name_;
-        istream& is_;
+        std::istream& is_;
 
 
     // Private Member Functions
 
         char nextValid();
 
-        void readWordToken(token&);
+        void readWordToken(token& t);
 
     // Private Member Functions
 
 
         //- Read a verbatim string (excluding block delimiters).
-        Istream& readVerbatim(string&);
+        Istream& readVerbatim(string& str);
 
         //- Read a variable name (includes '{')
-        Istream& readVariable(string&);
+        Istream& readVariable(string& str);
 
         //- Disallow default bitwise assignment
         void operator=(const ISstream&) = delete;
@@ -85,7 +85,7 @@ public:
         //- Construct as wrapper around istream
         inline ISstream
         (
-            istream& is,
+            std::istream& is,
             const string& name,
             streamFormat format=ASCII,
             versionNumber version=currentVersion,
@@ -123,7 +123,7 @@ public:
         // Read functions
 
             //- Raw, low-level get character function.
-            inline ISstream& get(char&);
+            inline ISstream& get(char& c);
 
             //- Raw, low-level peek function.
             //  Does not remove the character from the stream.
@@ -132,36 +132,36 @@ public:
             inline int peek();
 
             //- Raw, low-level getline into a string function.
-            inline ISstream& getLine(string&);
+            inline ISstream& getLine(string& str);
 
             //- Raw, low-level putback character function.
-            inline ISstream& putback(const char&);
+            inline ISstream& putback(const char c);
 
             //- Return next token from stream
-            virtual Istream& read(token&);
+            virtual Istream& read(token& t);
 
             //- Read a character
-            virtual Istream& read(char&);
+            virtual Istream& read(char& c);
 
             //- Read a word
-            virtual Istream& read(word&);
+            virtual Istream& read(word& str);
 
             //- Read a string (including enclosing double-quotes).
             //  Backslashes are retained, except when escaping double-quotes
             //  and an embedded newline character.
-            virtual Istream& read(string&);
+            virtual Istream& read(string& str);
 
             //- Read a label
-            virtual Istream& read(label&);
+            virtual Istream& read(label& val);
 
             //- Read a floatScalar
-            virtual Istream& read(floatScalar&);
+            virtual Istream& read(floatScalar& val);
 
             //- Read a doubleScalar
-            virtual Istream& read(doubleScalar&);
+            virtual Istream& read(doubleScalar& val);
 
             //- Read binary block
-            virtual Istream& read(char*, std::streamsize);
+            virtual Istream& read(char* buf, std::streamsize count);
 
             //- Rewind and return the stream so that it may be read again
             virtual Istream& rewind();
@@ -169,20 +169,20 @@ public:
 
         // Stream state functions
 
-            //- Set flags of output stream
+            //- Set stream flags
             virtual ios_base::fmtflags flags(const ios_base::fmtflags flags);
 
 
         // STL stream
 
             //- Access to underlying std::istream
-            virtual istream& stdStream()
+            virtual std::istream& stdStream()
             {
                 return is_;
             }
 
             //- Const access to underlying std::istream
-            virtual const istream& stdStream() const
+            virtual const std::istream& stdStream() const
             {
                 return is_;
             }
@@ -191,7 +191,7 @@ public:
         // Print
 
             //- Print description of IOstream to Ostream
-            virtual void print(Ostream&) const;
+            virtual void print(Ostream& os) const;
 };
 
 
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H
index 35f8f863188db5065b26fb70871aeb105d23905a..ecad21b4173275827f47a07aecfd5cf779ab5036 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H
@@ -23,13 +23,11 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "ISstream.H"
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 inline Foam::ISstream::ISstream
 (
-    istream& is,
+    std::istream& is,
     const string& name,
     streamFormat format,
     versionNumber version,
@@ -74,9 +72,9 @@ inline int Foam::ISstream::peek()
 }
 
 
-inline Foam::ISstream& Foam::ISstream::getLine(string& s)
+inline Foam::ISstream& Foam::ISstream::getLine(string& str)
 {
-    getline(is_, s);
+    std::getline(is_, str);
     setState(is_.rdstate());
     lineNumber_++;
 
@@ -84,7 +82,7 @@ inline Foam::ISstream& Foam::ISstream::getLine(string& s)
 }
 
 
-inline Foam::ISstream& Foam::ISstream::putback(const char& c)
+inline Foam::ISstream& Foam::ISstream::putback(const char c)
 {
     if (c == '\n')
     {
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
index e0b56d725bb75379bdf585f2f915035b92d27a56..4c6e97fd59386ae6c3c599daaf009fb82e25c107 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
@@ -56,7 +56,7 @@ class OSstream
     // Private data
 
         fileName name_;
-        ostream& os_;
+        std::ostream& os_;
 
 
     // Private Member Functions
@@ -72,7 +72,7 @@ public:
         //- Construct and set stream status
         OSstream
         (
-            ostream& os,
+            std::ostream& os,
             const string& name,
             streamFormat format=ASCII,
             versionNumber version=currentVersion,
@@ -105,45 +105,45 @@ public:
         // Write functions
 
             //- Write next token to stream
-            virtual Ostream& write(const token&);
+            virtual Ostream& write(const token& t);
 
             //- Write character
-            virtual Ostream& write(const char);
+            virtual Ostream& write(const char c);
 
             //- Write character string
-            virtual Ostream& write(const char*);
+            virtual Ostream& write(const char* str);
 
             //- Write word
-            virtual Ostream& write(const word&);
+            virtual Ostream& write(const word& str);
 
             //- Write string
             //  In the rare case that the string contains a final trailing
             //  backslash, it will be dropped to the appearance of an escaped
             //  double-quote.
-            virtual Ostream& write(const string&);
+            virtual Ostream& write(const string& str);
 
             //- Write std::string surrounded by quotes.
             //  Optional write without quotes.
             virtual Ostream& writeQuoted
             (
-                const std::string&,
+                const std::string& str,
                 const bool quoted=true
             );
 
             //- Write int32_t
-            virtual Ostream& write(const int32_t);
+            virtual Ostream& write(const int32_t val);
 
             //- Write int64_t
-            virtual Ostream& write(const int64_t);
+            virtual Ostream& write(const int64_t val);
 
             //- Write floatScalar
-            virtual Ostream& write(const floatScalar);
+            virtual Ostream& write(const floatScalar val);
 
             //- Write doubleScalar
-            virtual Ostream& write(const doubleScalar);
+            virtual Ostream& write(const doubleScalar val);
 
             //- Write binary block
-            virtual Ostream& write(const char*, std::streamsize);
+            virtual Ostream& write(const char* buf, std::streamsize count);
 
             //- Add indentation characters
             virtual void indent();
@@ -151,8 +151,8 @@ public:
 
         // Stream state functions
 
-            //- Set flags of output stream
-            virtual ios_base::fmtflags flags(const ios_base::fmtflags flags);
+            //- Set stream flags
+            virtual ios_base::fmtflags flags(const ios_base::fmtflags f);
 
             //- Flush stream
             virtual void flush();
@@ -163,26 +163,28 @@ public:
             //- Get width of output field
             virtual int width() const;
 
-            //- Set width of output field (and return old width)
-            virtual int width(const int);
+            //- Set width of output field
+            // \return previous width
+            virtual int width(const int w);
 
             //- Get precision of output field
             virtual int precision() const;
 
-            //- Set precision of output field (and return old precision)
-            virtual int precision(const int);
+            //- Set precision of output field
+            // \return old precision
+            virtual int precision(const int p);
 
 
         // STL stream
 
             //- Access to underlying std::ostream
-            virtual ostream& stdStream()
+            virtual std::ostream& stdStream()
             {
                 return os_;
             }
 
             //- Const access to underlying std::ostream
-            virtual const ostream& stdStream() const
+            virtual const std::ostream& stdStream() const
             {
                 return os_;
             }
@@ -191,7 +193,7 @@ public:
         // Print
 
             //- Print description of IOstream to Ostream
-            virtual void print(Ostream&) const;
+            virtual void print(Ostream& os) const;
 };
 
 
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstreamI.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstreamI.H
index 45329e9a1d8c4909b878aa2f9bb609839239e71a..9aaf3645014c942c42c31fc309d17136da5d33d8 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstreamI.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstreamI.H
@@ -29,7 +29,7 @@ License
 
 inline Foam::OSstream::OSstream
 (
-    ostream& os,
+    std::ostream& os,
     const string& name,
     streamFormat format,
     versionNumber version,
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
index 5eb8c506ed20e213457a554f1cf99041038bed10..f9ff715821afa3cef7b0a10bd6b7c76ecc2838a9 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
@@ -43,7 +43,7 @@ inline void Foam::prefixOSstream::checkWritePrefix()
 
 Foam::prefixOSstream::prefixOSstream
 (
-    ostream& os,
+    std::ostream& os,
     const string& name,
     streamFormat format,
     versionNumber version,
@@ -182,4 +182,5 @@ void Foam::prefixOSstream::indent()
     OSstream::indent();
 }
 
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H
index b7f0ddc5b88c6728da2eb0b4aeab1280b61d867c..8912793a55220d6e8f3955afd170ddd877ca0be8 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H
@@ -46,7 +46,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class prefixOSstream Declaration
+                       Class prefixOSstream Declaration
 \*---------------------------------------------------------------------------*/
 
 class prefixOSstream
@@ -71,7 +71,7 @@ public:
         //- Construct and set stream status
         prefixOSstream
         (
-            ostream& os,
+            std::ostream& os,
             const string& name,
             streamFormat format=ASCII,
             versionNumber version=currentVersion,
@@ -83,13 +83,13 @@ public:
 
         // Enquiry
 
-            //- Return the prefix of the stream
+            //- Return the sream prefix
             const string& prefix() const
             {
                 return prefix_;
             }
 
-            //- Return non-const access to the prefix of the stream
+            //- Return non-const access to the stream prefix
             string& prefix()
             {
                 return prefix_;
@@ -99,42 +99,42 @@ public:
         // Write functions
 
             //- Write next token to stream
-            virtual Ostream& write(const token&);
+            virtual Ostream& write(const token& t);
 
             //- Write character
-            virtual Ostream& write(const char);
+            virtual Ostream& write(const char c);
 
             //- Write character string
-            virtual Ostream& write(const char*);
+            virtual Ostream& write(const char* str);
 
             //- Write word
-            virtual Ostream& write(const word&);
+            virtual Ostream& write(const word& val);
 
             //- Write string
-            virtual Ostream& write(const string&);
+            virtual Ostream& write(const string& val);
 
             //- Write std::string surrounded by quotes.
             //  Optional write without quotes.
             virtual Ostream& writeQuoted
             (
-                const std::string&,
+                const std::string& val,
                 const bool quoted=true
             );
 
             //- Write int32_t
-            virtual Ostream& write(const int32_t);
+            virtual Ostream& write(const int32_t val);
 
             //- Write int64_t
-            virtual Ostream& write(const int64_t);
+            virtual Ostream& write(const int64_t val);
 
             //- Write floatScalar
-            virtual Ostream& write(const floatScalar);
+            virtual Ostream& write(const floatScalar val);
 
             //- Write doubleScalar
-            virtual Ostream& write(const doubleScalar);
+            virtual Ostream& write(const doubleScalar val);
 
             //- Write binary block
-            virtual Ostream& write(const char*, std::streamsize);
+            virtual Ostream& write(const char* buf, std::streamsize count);
 
             //- Add indentation characters
             virtual void indent();
@@ -143,7 +143,7 @@ public:
         // Print
 
             //- Print description of IOstream to Ostream
-            virtual void print(Ostream&) const;
+            virtual void print(Ostream& os) const;
 };
 
 
diff --git a/src/OpenFOAM/db/IOstreams/StringStreams/IStringStream.H b/src/OpenFOAM/db/IOstreams/StringStreams/IStringStream.H
index b4f86ec62e0c6857479ae7f5bc890dca56934fb2..5f77ca3d54e3265d1e81d97f832ac2da6b49f92e 100644
--- a/src/OpenFOAM/db/IOstreams/StringStreams/IStringStream.H
+++ b/src/OpenFOAM/db/IOstreams/StringStreams/IStringStream.H
@@ -1,141 +1,13 @@
 /*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-Class
-    Foam::IStringStream
-
 Description
-    Input from memory buffer stream.
-
-SourceFiles
-    StringStreamsPrint.C
+    Compatibility include
 
 \*---------------------------------------------------------------------------*/
 
 #ifndef IStringStream_H
 #define IStringStream_H
 
-#include "ISstream.H"
-#include <sstream>
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                           Class IStringStream Declaration
-\*---------------------------------------------------------------------------*/
-
-class IStringStream
-:
-    public ISstream
-{
-
-public:
-
-    // Constructors
-
-        //- Construct from string
-        IStringStream
-        (
-            const string& buffer,
-            streamFormat format=ASCII,
-            versionNumber version=currentVersion
-        )
-        :
-            ISstream
-            (
-                *(new std::istringstream(buffer)),
-                "input",
-                format,
-                version
-            )
-        {}
-
-
-        //- Construct from char*
-        IStringStream
-        (
-            const char* buffer,
-            streamFormat format=ASCII,
-            versionNumber version=currentVersion
-        )
-        :
-            ISstream
-            (
-                *(new std::istringstream(buffer)),
-                "input",
-                format,
-                version
-            )
-        {}
-
-
-    //- Destructor
-    ~IStringStream()
-    {
-        delete &dynamic_cast<std::istringstream&>(stdStream());
-    }
-
-
-    // Member functions
-
-        // Access
-
-            //- Return the string
-            string str() const
-            {
-                return dynamic_cast<const std::istringstream&>
-                (
-                    stdStream()
-                ).str();
-            }
-
-
-        // Print
-
-            //- Print description to Ostream
-            void print(Ostream&) const;
-
-
-    // Member operators
-
-        //- Return a non-const reference to const Istream
-        //  Needed for read-constructors where the stream argument is temporary:
-        //  e.g. thing thisThing(IFstream("thingFileName")());
-        Istream& operator()() const
-        {
-            return const_cast<IStringStream&>(*this);
-        }
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#include "StringStream.H"
 
 #endif
 
diff --git a/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H b/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H
index c6fc3103f26d63c8f58d3569d0b5e5ce61aad276..c4d79e11aaa04e7ebff1e6b82cf4785ef95b7505 100644
--- a/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H
+++ b/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H
@@ -1,140 +1,13 @@
 /*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-Class
-    Foam::OStringStream
-
 Description
-    Output to memory buffer stream.
-
-SourceFiles
-    StringStreamsPrint.C
+    Compatibility include
 
 \*---------------------------------------------------------------------------*/
 
 #ifndef OStringStream_H
 #define OStringStream_H
 
-#include "OSstream.H"
-#include <sstream>
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                        Class OStringStream Declaration
-\*---------------------------------------------------------------------------*/
-
-class OStringStream
-:
-    public OSstream
-{
-
-public:
-
-    // Constructors
-
-        //- Construct and set stream status
-        OStringStream
-        (
-            streamFormat format=ASCII,
-            versionNumber version=currentVersion
-        )
-        :
-            OSstream
-            (
-               *(new std::ostringstream()),
-                "output",
-                format,
-                version
-            )
-        {}
-
-        //- Construct as copy
-        OStringStream(const OStringStream& oss)
-        :
-            OSstream
-            (
-               *(
-                    new std::ostringstream
-                    (
-                        dynamic_cast<const std::ostringstream&>
-                        (
-                            oss.stdStream()
-                        ).str()
-                    )
-                ),
-                oss.name(),
-                oss.format(),
-                oss.version()
-            )
-        {}
-
-
-    //- Destructor
-    ~OStringStream()
-    {
-        delete &dynamic_cast<std::ostringstream&>(stdStream());
-    }
-
-
-    // Member functions
-
-        // Access
-
-            //- Return the string
-            string str() const
-            {
-                return dynamic_cast<const std::ostringstream&>
-                (
-                    stdStream()
-                ).str();
-            }
-
-
-        // Edit
-
-            //- Rewind the OStringStream
-            void rewind()
-            {
-                stdStream().rdbuf()->pubseekpos(0);
-            }
-
-
-        // Print
-
-            //- Print description to Ostream
-            void print(Ostream& os) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#include "StringStream.H"
 
 #endif
 
diff --git a/src/OpenFOAM/db/IOstreams/StringStreams/StringStreamsPrint.C b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.C
similarity index 89%
rename from src/OpenFOAM/db/IOstreams/StringStreams/StringStreamsPrint.C
rename to src/OpenFOAM/db/IOstreams/StringStreams/StringStream.C
index 334235ff6bf7f8562d18ce71d6efc7651d92be25..b6adec7119b8216b58d382f016e983a20301bc60 100644
--- a/src/OpenFOAM/db/IOstreams/StringStreams/StringStreamsPrint.C
+++ b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.C
@@ -21,15 +21,11 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-Description
-    Prints out a description of the StringStream
-
 \*---------------------------------------------------------------------------*/
 
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 void Foam::IStringStream::print(Ostream& os) const
 {
@@ -40,6 +36,8 @@ void Foam::IStringStream::print(Ostream& os) const
 }
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
 void Foam::OStringStream::print(Ostream& os) const
 {
     os  << "OStringStream " << name() << " : "
diff --git a/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H
new file mode 100644
index 0000000000000000000000000000000000000000..3f50c2fac785c24dfd76f753408d50792ba7a076
--- /dev/null
+++ b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H
@@ -0,0 +1,254 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+InClass
+    Foam::StringStream
+
+Description
+    Input/output from string buffers.
+
+SourceFiles
+    StringStream.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef StringStream_H
+#define StringStream_H
+
+#include "ISstream.H"
+#include "OSstream.H"
+#include <sstream>
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                    Class StringStreamAllocator Declaration
+\*---------------------------------------------------------------------------*/
+
+//- Allocator for variants of a std stringstream
+template<class StreamType>
+class StringStreamAllocator
+{
+protected:
+
+    // Member Data
+
+        //- The allocated stream pointer.
+        StreamType* allocatedPtr_;
+
+
+    // Constructors
+
+        //- Construct null
+        StringStreamAllocator()
+        :
+            allocatedPtr_(new StreamType())
+        {}
+
+        //- Construct from pointer, taking ownership
+        StringStreamAllocator(StreamType* ptr)
+        :
+            allocatedPtr_(ptr)
+        {}
+
+        //- Construct from string
+        StringStreamAllocator(const std::string& buffer)
+        :
+            allocatedPtr_(new StreamType(buffer))
+        {}
+
+
+    //- Destructor
+    ~StringStreamAllocator()
+    {
+        deallocate();
+    }
+
+
+    // Protected Member Functions
+
+        //- Delete the stream pointer
+        void deallocate()
+        {
+            if (allocatedPtr_)
+            {
+                delete allocatedPtr_;
+                allocatedPtr_ = nullptr;
+            }
+        }
+
+
+public:
+
+    // Public Member Functions
+
+        //- Get the string
+        Foam::string str() const
+        {
+            return allocatedPtr_->str();
+        }
+
+        //- Set the string
+        void str(const std::string& s)
+        {
+            allocatedPtr_->str(s);
+        }
+};
+
+
+/*---------------------------------------------------------------------------*\
+                        Class IStringStream Declaration
+\*---------------------------------------------------------------------------*/
+
+//- Input from string buffer, using a ISstream
+class IStringStream
+:
+    public StringStreamAllocator<std::istringstream>,
+    public ISstream
+{
+public:
+
+    // Constructors
+
+        //- Construct from string
+        IStringStream
+        (
+            const Foam::string& buffer,
+            streamFormat format=ASCII,
+            versionNumber version=currentVersion
+        )
+        :
+            StringStreamAllocator<std::istringstream>(buffer),
+            ISstream(*allocatedPtr_, "input", format, version)
+        {}
+
+
+        //- Construct from char*
+        IStringStream
+        (
+            const char* buffer,
+            streamFormat format=ASCII,
+            versionNumber version=currentVersion
+        )
+        :
+            StringStreamAllocator<std::istringstream>(buffer),
+            ISstream(*allocatedPtr_, "input", format, version)
+        {}
+
+
+    //- Destructor
+    ~IStringStream()
+    {}
+
+
+    // Member Functions
+
+        //- Print description to Ostream
+        void print(Ostream& os) const;
+
+
+    // Member operators
+
+        //- Return a non-const reference to const Istream
+        //  Needed for read-constructors where the stream argument is temporary:
+        //  e.g. thing thisThing(IFstream("thingFileName")());
+        Istream& operator()() const
+        {
+            return const_cast<IStringStream&>(*this);
+        }
+
+};
+
+
+/*---------------------------------------------------------------------------*\
+                        Class OStringStream Declaration
+\*---------------------------------------------------------------------------*/
+
+//- Output to string buffer, using a OSstream
+class OStringStream
+:
+    public StringStreamAllocator<std::ostringstream>,
+    public OSstream
+{
+public:
+
+    // Constructors
+
+        //- Construct and set stream status
+        OStringStream
+        (
+            streamFormat format=ASCII,
+            versionNumber version=currentVersion
+        )
+        :
+            StringStreamAllocator<std::ostringstream>(),
+            OSstream(*allocatedPtr_, "output", format, version)
+        {}
+
+        //- Construct as copy
+        OStringStream(const OStringStream& oss)
+        :
+            StringStreamAllocator<std::ostringstream>(oss.str()),
+            OSstream(*allocatedPtr_, oss.name(), oss.format(), oss.version())
+        {}
+
+
+    //- Destructor
+    ~OStringStream()
+    {}
+
+
+    // Member Functions
+
+        //- Reset the output buffer and rewind the stream
+        void reset()
+        {
+            this->str("");  // No other way to reset the end
+            this->rewind();
+        }
+
+        //- Rewind the output stream
+        void rewind()
+        {
+            // pubseekpos() instead of seekp() for symmetry with other classes
+            allocatedPtr_->rdbuf()->pubseekpos(0, std::ios_base::out);
+        }
+
+        //- Print description to Ostream
+        void print(Ostream& os) const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H
index d0f3ce2d59991b0d9f38f83f1e450d9ceea24e69..8a43d3d7b1561245f55a7216698173ae56140242 100644
--- a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H
+++ b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H
@@ -126,6 +126,61 @@ public:
 };
 
 
+/*---------------------------------------------------------------------------*\
+                    Class OSHA1streamAllocator Declaration
+\*---------------------------------------------------------------------------*/
+
+//- Allocator for an osha1stream
+class OSHA1streamAllocator
+{
+protected:
+
+    // Member data
+
+        //- The allocated stream pointer
+        osha1stream* allocatedPtr_;
+
+
+    // Constructors
+
+        //- Construct null
+        OSHA1streamAllocator()
+        :
+            allocatedPtr_(new osha1stream())
+        {}
+
+
+    //- Destructor
+    ~OSHA1streamAllocator()
+    {
+        deallocate();
+    }
+
+
+    // Member Functions
+
+        //- Delete the stream pointer
+        void deallocate()
+        {
+            if (allocatedPtr_)
+            {
+                delete allocatedPtr_;
+                allocatedPtr_ = nullptr;
+            }
+        }
+
+
+public:
+
+        //- Full access to the sha1
+        SHA1& sha1()
+        {
+            return allocatedPtr_->sha1();
+        }
+
+};
+
+
 /*---------------------------------------------------------------------------*\
                          Class OSHA1stream Declaration
 \*---------------------------------------------------------------------------*/
@@ -133,6 +188,7 @@ public:
 //- The output stream for calculating SHA1 digests
 class OSHA1stream
 :
+    public OSHA1streamAllocator,
     public OSstream
 {
 
@@ -155,35 +211,22 @@ public:
             versionNumber version=currentVersion
         )
         :
-            OSstream
-            (
-                *(new osha1stream),
-                "OSHA1stream",
-                format,
-                version
-            )
+            OSHA1streamAllocator(),
+            OSstream(*allocatedPtr_, "OSHA1stream", format, version)
         {}
 
 
     //- Destructor
     ~OSHA1stream()
-    {
-        delete &dynamic_cast<osha1stream&>(stdStream());
-    }
+    {}
 
 
     // Member functions
 
       // Access
 
-        //- Full access to the sha1
-        Foam::SHA1& sha1()
-        {
-            return dynamic_cast<osha1stream&>(stdStream()).sha1();
-        }
-
         //- Return SHA1::Digest for the data processed until now
-        Foam::SHA1Digest digest()
+        SHA1Digest digest()
         {
             return sha1().digest();
         }
@@ -192,6 +235,13 @@ public:
       // Edit
 
         //- Clear the SHA1 calculation
+        void reset()
+        {
+            sha1().clear();
+        }
+
+        //- Clear the SHA1 calculation
+        //  \deprecated use reset instead (deprecated Jul 2017)
         void rewind()
         {
             sha1().clear();
diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H
index 26dc543f5b00e45a8176655bd73e3eec18c7f41b..b883cd376d527cb1a0aeaf01e95b3b0aa02182fd 100644
--- a/src/OpenFOAM/db/IOstreams/token/token.H
+++ b/src/OpenFOAM/db/IOstreams/token/token.H
@@ -59,8 +59,8 @@ namespace Foam
 
 class token;
 
-Istream& operator>>(Istream&, token&);
-Ostream& operator<<(Ostream&, const token&);
+Istream& operator>>(Istream& is, token& t);
+Ostream& operator<<(Ostream& os, const token& t);
 
 
 /*---------------------------------------------------------------------------*\
@@ -418,8 +418,8 @@ public:
 
     // IOstream operators
 
-        friend Istream& operator>>(Istream&, token&);
-        friend Ostream& operator<<(Ostream&, const token&);
+        friend Istream& operator>>(Istream& is, token& t);
+        friend Ostream& operator<<(Ostream& os, const token& t);
 
         friend Ostream& operator<<(Ostream&, const punctuationToken&);
         friend ostream& operator<<(ostream&, const punctuationToken&);
diff --git a/src/OpenFOAM/db/IOstreams/token/tokenI.H b/src/OpenFOAM/db/IOstreams/token/tokenI.H
index 2f0383c9b25fd686e5a5c176a93f850ddd6c59b1..9831e0569551001803544d08216d7f77a8a4617a 100644
--- a/src/OpenFOAM/db/IOstreams/token/tokenI.H
+++ b/src/OpenFOAM/db/IOstreams/token/tokenI.H
@@ -23,8 +23,6 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include <iostream>
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 inline void Foam::token::clear()
diff --git a/src/OpenFOAM/db/IOstreams/token/tokenIO.C b/src/OpenFOAM/db/IOstreams/token/tokenIO.C
index c35047408070a79e1656c8df70b2e37a07a11bfd..acf14b96fec6ce949f7a84760aa0229fb02ad360 100644
--- a/src/OpenFOAM/db/IOstreams/token/tokenIO.C
+++ b/src/OpenFOAM/db/IOstreams/token/tokenIO.C
@@ -39,7 +39,7 @@ Foam::token::token(Istream& is)
 }
 
 
-// * * * * * * * * * * * * IOstream operators  * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
 Foam::Istream& Foam::operator>>(Istream& is, token& t)
 {
diff --git a/src/OpenFOAM/db/Time/findTimes.C b/src/OpenFOAM/db/Time/findTimes.C
index ccd7312a2bc4dd877c23dcc96bb359c78f8ae0b7..1046d82843ee06c9f8df4a7f5bee537213dfd57a 100644
--- a/src/OpenFOAM/db/Time/findTimes.C
+++ b/src/OpenFOAM/db/Time/findTimes.C
@@ -30,7 +30,7 @@ Description
 
 #include "Time.H"
 #include "OSspecific.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C
index b6b6e4e66e18eb0a465215c7b5d2c7b7c7cbfdf7..875064b2e87d8de7afb38a5371d4d075f1c22c5a 100644
--- a/src/OpenFOAM/db/Time/timeSelector.C
+++ b/src/OpenFOAM/db/Time/timeSelector.C
@@ -27,7 +27,7 @@ License
 #include "ListOps.H"
 #include "argList.H"
 #include "Time.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/dictionary/entry/entry.C b/src/OpenFOAM/db/dictionary/entry/entry.C
index 991a51f1a106ac9cdb4f854254bef1922b9e4a03..afb5a725229564f7d5e5f213dd74af45beeb2310 100644
--- a/src/OpenFOAM/db/dictionary/entry/entry.C
+++ b/src/OpenFOAM/db/dictionary/entry/entry.C
@@ -25,7 +25,7 @@ License
 
 #include "entry.H"
 #include "dictionary.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
index 34c871a683a36105a543be136870ac14c335420a..66e510a38f8217484843d86e0c4d8113d36b0057 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
@@ -25,8 +25,7 @@ License
 
 #include "codeStream.H"
 #include "addToMemberFunctionSelectionTable.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "dynamicCode.H"
 #include "dynamicCodeContext.H"
 #include "Time.H"
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
index 7d07d43c3ea16b7cc4e352939848fb1fafa5c0b4..e43c1f31f351137a7fbdc8999df494adb0e8f671 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
@@ -26,8 +26,7 @@ License
 #include "removeEntry.H"
 #include "dictionary.H"
 #include "stringListOps.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "addToMemberFunctionSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C
index 57c1b9775f0a4f49ec6dad75546efc9675d79e8a..29f11a5c80f85d005635c8831971273a5aa0cf8b 100644
--- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C
+++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C
@@ -25,8 +25,7 @@ License
 
 #include "primitiveEntry.H"
 #include "dictionary.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/error/IOerror.C b/src/OpenFOAM/db/error/IOerror.C
index 1544db32cea90857bf8238f9b9df7dbfcc5fb951..4e2fab2e0e87ee69f71566b229b37c35c1537c83 100644
--- a/src/OpenFOAM/db/error/IOerror.C
+++ b/src/OpenFOAM/db/error/IOerror.C
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "fileName.H"
 #include "dictionary.H"
 #include "JobInfo.H"
@@ -193,8 +193,8 @@ void Foam::IOerror::exit(const int)
             // Make a copy of the error to throw
             IOerror errorException(*this);
 
-            // Rewind the message buffer for the next error message
-            messageStreamPtr_->rewind();
+            // Reset the message buffer for the next error message
+            messageStreamPtr_->reset();
 
             throw errorException;
         }
@@ -238,8 +238,8 @@ void Foam::IOerror::abort()
             // Make a copy of the error to throw
             IOerror errorException(*this);
 
-            // Rewind the message buffer for the next error message
-            messageStreamPtr_->rewind();
+            // Reset the message buffer for the next error message
+            messageStreamPtr_->reset();
 
             throw errorException;
         }
diff --git a/src/OpenFOAM/db/error/error.C b/src/OpenFOAM/db/error/error.C
index f29eafb486d4059c331336e0e18cf4fe4a8416a1..e0dbff97d8c7b9f8226ee0cadf421a96b7bec357 100644
--- a/src/OpenFOAM/db/error/error.C
+++ b/src/OpenFOAM/db/error/error.C
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "fileName.H"
 #include "dictionary.H"
 #include "JobInfo.H"
@@ -188,8 +188,8 @@ void Foam::error::exit(const int errNo)
             // Make a copy of the error to throw
             error errorException(*this);
 
-            // Rewind the message buffer for the next error message
-            messageStreamPtr_->rewind();
+            // Reset the message buffer for the next error message
+            messageStreamPtr_->reset();
 
             throw errorException;
         }
@@ -233,8 +233,8 @@ void Foam::error::abort()
             // Make a copy of the error to throw
             error errorException(*this);
 
-            // Rewind the message buffer for the next error message
-            messageStreamPtr_->rewind();
+            // Reset the message buffer for the next error message
+            messageStreamPtr_->reset();
 
             throw errorException;
         }
diff --git a/src/OpenFOAM/db/error/messageStream.C b/src/OpenFOAM/db/error/messageStream.C
index 7ca86cc7aab991c5dc4fd773c4a9dc9aa8f2b77d..661d24960247b1961f0dd0ce93c8cc043392cec2 100644
--- a/src/OpenFOAM/db/error/messageStream.C
+++ b/src/OpenFOAM/db/error/messageStream.C
@@ -31,17 +31,18 @@ License
 
 int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::messageStream::messageStream
 (
     const string& title,
-    errorSeverity sev,
+    const errorSeverity severity,
     const int maxErrors
 )
 :
     title_(title),
-    severity_(sev),
+    severity_(severity),
     maxErrors_(maxErrors),
     errorCount_(0)
 {}
@@ -56,6 +57,8 @@ Foam::messageStream::messageStream(const dictionary& dict)
 {}
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
 Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
 {
     if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
@@ -76,6 +79,8 @@ Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
 }
 
 
+// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+
 Foam::OSstream& Foam::messageStream::operator()
 (
     const char* functionName,
@@ -237,7 +242,7 @@ Foam::messageStream::operator Foam::OSstream&()
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Global Variables  * * * * * * * * * * * * * //
 
 Foam::messageStream Foam::SeriousError
 (
diff --git a/src/OpenFOAM/db/error/messageStream.H b/src/OpenFOAM/db/error/messageStream.H
index a86b7954c845e515b36d83cd26d73a2878a5718f..af9c40ecb2161e22807c6b049d4608a00b0addd0 100644
--- a/src/OpenFOAM/db/error/messageStream.H
+++ b/src/OpenFOAM/db/error/messageStream.H
@@ -28,8 +28,8 @@ Description
     Class to handle messaging in a simple, consistent stream-based
     manner.
 
-    The messageStream class is globaly instantiated with a title string a
-    given severity, which controls the program termination, and a number of
+    The messageStream class is globaly instantiated with a title string and
+    a severity (which controls the program termination) and a number of
     errors before termination.  Errors, messages and other data are piped to
     the messageStream class in the standard manner.
 
@@ -104,13 +104,13 @@ public:
         messageStream
         (
             const string& title,
-            errorSeverity,
+            const errorSeverity severity,
             const int maxErrors = 0
         );
 
 
-        //- Construct from dictionary
-        messageStream(const dictionary&);
+        //- Construct as Fatal from dictionary, extracting the 'title'.
+        messageStream(const dictionary& dict);
 
 
     // Member functions
diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C
index 11279746aa2a72ab3ccd3a49bc2f2e951c537e06..3b4d84d16ae99313c8076c329f2be8e66a12f4f1 100644
--- a/src/OpenFOAM/dimensionSet/dimensionSet.C
+++ b/src/OpenFOAM/dimensionSet/dimensionSet.C
@@ -25,7 +25,7 @@ License
 
 #include "dimensionSet.H"
 #include "dimensionedScalar.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H
index 569125c7da9ac0e4b0955663987e162cfa2c35e5..b17ff484f9f0b239da86a9d63660d6b25b5441bf 100644
--- a/src/OpenFOAM/global/argList/argList.H
+++ b/src/OpenFOAM/global/argList/argList.H
@@ -100,7 +100,7 @@ SourceFiles
 #include "word.H"
 #include "fileName.H"
 #include "parRun.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "OSspecific.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C
index fdf643f8e4324367e6b944abe2359575540db11b..aeec9a354378cff2588a06af777a3e734803db5a 100644
--- a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C
+++ b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C
@@ -28,7 +28,7 @@ License
 #include "boolList.H"
 #include "IOstreams.H"
 #include "IOmanip.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "Pstream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
index 488d6dc366210a90b5e7c6b53af81b08dc37fabd..c3ed0bf803432f0e422e53464bdbcb7607ca54cd 100644
--- a/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
+++ b/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
@@ -25,7 +25,7 @@ License
 
 #include "vectorTensorTransform.H"
 #include "IOstreams.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/primitives/ints/int32/int32IO.C b/src/OpenFOAM/primitives/ints/int32/int32IO.C
index 1759f87daa508a2afb64445480dc65b8b74aef64..0a7f18b6f2f2aab2cb2b036a112b1d426c4c4ba0 100644
--- a/src/OpenFOAM/primitives/ints/int32/int32IO.C
+++ b/src/OpenFOAM/primitives/ints/int32/int32IO.C
@@ -28,7 +28,6 @@ License
 #include "IOstreams.H"
 
 #include <inttypes.h>
-#include <sstream>
 #include <cerrno>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C
index fe6ce5f56896857a26f86e26199699eb778e46be..19d93bf8a8f8fd9a0b3ccc17783f9ca4601357e7 100644
--- a/src/OpenFOAM/primitives/ints/int64/int64IO.C
+++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C
@@ -28,7 +28,6 @@ License
 #include "IOstreams.H"
 
 #include <inttypes.h>
-#include <sstream>
 #include <cerrno>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32IO.C b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
index 9c46c5d649c1fd1708722b4ee04417709d58456d..240c1029a88025a701c135eb5a6edd3be99b8351 100644
--- a/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
+++ b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
@@ -27,8 +27,6 @@ License
 #include "stringOps.H"
 #include "IOstreams.H"
 
-#include <sstream>
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 Foam::word Foam::name(const char* fmt, const uint32_t val)
diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
index 02e8d2284dee9935c2d0a0aebf68a7677c99ae5f..18eb5ab5f4797bd1960486ec1afdb607151c1a0f 100644
--- a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
+++ b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
@@ -27,8 +27,6 @@ License
 #include "stringOps.H"
 #include "IOstreams.H"
 
-#include <sstream>
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 Foam::word Foam::name(const char* fmt, const uint64_t val)
diff --git a/src/OpenFOAM/primitives/quaternion/quaternion.C b/src/OpenFOAM/primitives/quaternion/quaternion.C
index 18cfda5a60e8103bf2409d1b229176c6e5670cc8..0ad09b5f6fa3fabc387e86f80b698ba562316087 100644
--- a/src/OpenFOAM/primitives/quaternion/quaternion.C
+++ b/src/OpenFOAM/primitives/quaternion/quaternion.C
@@ -25,7 +25,7 @@ License
 
 #include "quaternion.H"
 #include "IOstreams.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/primitives/septernion/septernion.C b/src/OpenFOAM/primitives/septernion/septernion.C
index 6e786ce7a09dc6197c2bf2c3c8080ca05e717f94..53c4acded3e6d5f08fdb5e80b2608e98bffcb707 100644
--- a/src/OpenFOAM/primitives/septernion/septernion.C
+++ b/src/OpenFOAM/primitives/septernion/septernion.C
@@ -25,7 +25,7 @@ License
 
 #include "septernion.H"
 #include "IOstreams.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
index dca9fe5e087f60cbe395df2aeef9e9f20bc40b7c..ea6d81ef0448b65fa46642a1bbaeb249cd396998 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
@@ -27,7 +27,7 @@ License
 #include "typeInfo.H"
 #include "OSspecific.H"
 #include "etcFiles.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/conversion/ccm/writer/ccmWriterSolution.C b/src/conversion/ccm/writer/ccmWriterSolution.C
index 3887f895e50e38bbbd562f1e40a80579e7a8fb69..f277629b1b8eab7fc85de34d11b3b27148d1504d 100644
--- a/src/conversion/ccm/writer/ccmWriterSolution.C
+++ b/src/conversion/ccm/writer/ccmWriterSolution.C
@@ -26,7 +26,7 @@ License
 #include "ccmWriter.H"
 #include "dictionary.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "volFields.H"
 #include "surfaceFields.H"
 #include "ccmInternal.H"  // include last to avoid any strange interactions
diff --git a/src/conversion/vtk/output/foamVtkWriteSurfFields.C b/src/conversion/vtk/output/foamVtkWriteSurfFields.C
index 40c99456a1c6bd0bf4df0184966afb643f5a4f1e..bfe1f35038153a731c738266c23fe83a473bd6f7 100644
--- a/src/conversion/vtk/output/foamVtkWriteSurfFields.C
+++ b/src/conversion/vtk/output/foamVtkWriteSurfFields.C
@@ -45,7 +45,7 @@ void Foam::vtk::writeSurfFields
 
     const bool legacy_(opts.legacy());
 
-    std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
+    std::ofstream os(baseName + (legacy_ ? ".vtk" : ".vtp"));
     autoPtr<vtk::formatter> format = opts.newFormatter(os);
 
     // Same payload size for points and vector fields!
diff --git a/src/fileFormats/ensight/read/ensightReadFile.C b/src/fileFormats/ensight/read/ensightReadFile.C
index f73d95199e541aeb42939407a3296de95a91cc7d..3331176816286b821509e2e853da80fd5fcff1b1 100644
--- a/src/fileFormats/ensight/read/ensightReadFile.C
+++ b/src/fileFormats/ensight/read/ensightReadFile.C
@@ -24,7 +24,6 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "ensightReadFile.H"
-#include <sstream>
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/fileFormats/nas/NASCore.C b/src/fileFormats/nas/NASCore.C
index 45edbd9691283e87c955341ec367cb797ee1d2a6..98cefac905901f933e33e6cf8df66335c0499b80 100644
--- a/src/fileFormats/nas/NASCore.C
+++ b/src/fileFormats/nas/NASCore.C
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "NASCore.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/fileFormats/starcd/STARCDCore.C b/src/fileFormats/starcd/STARCDCore.C
index d6ff48fc57b1349fe69c0d5288ff9f3da04d4b1d..e9302bda2372706a7d5d0899ddddbb63346bb733 100644
--- a/src/fileFormats/starcd/STARCDCore.C
+++ b/src/fileFormats/starcd/STARCDCore.C
@@ -27,7 +27,7 @@ License
 #include "ListOps.H"
 #include "clock.H"
 #include "PackedBoolList.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "OSspecific.H"
 
 
diff --git a/src/fileFormats/stl/STLCore.C b/src/fileFormats/stl/STLCore.C
index bdfae0c02556f3387b9aa3a75ed979b519071cec..b3b748bd1a60d3e4b393929909ddfaa8750df703 100644
--- a/src/fileFormats/stl/STLCore.C
+++ b/src/fileFormats/stl/STLCore.C
@@ -89,9 +89,9 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
 )
 {
     bool compressed = false;
-    autoPtr<istream> streamPtr
+    autoPtr<std::istream> streamPtr
     (
-        new ifstream(filename.c_str(), std::ios::binary)
+        new std::ifstream(filename, std::ios::binary)
     );
 
     // If the file is compressed, decompress it before further checking.
@@ -100,7 +100,7 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
         compressed = true;
         streamPtr.reset(new igzstream((filename + ".gz").c_str()));
     }
-    istream& is = streamPtr();
+    std::istream& is = streamPtr();
 
     if (!is.good())
     {
@@ -165,9 +165,9 @@ Foam::fileFormats::STLCore::readBinaryHeader
     bool compressed = false;
     nTrisEstimated = 0;
 
-    autoPtr<istream> streamPtr
+    autoPtr<std::istream> streamPtr
     (
-        new ifstream(filename.c_str(), std::ios::binary)
+        new std::ifstream(filename, std::ios::binary)
     );
 
     // If the file is compressed, decompress it before reading.
@@ -176,7 +176,7 @@ Foam::fileFormats::STLCore::readBinaryHeader
         compressed = true;
         streamPtr.reset(new igzstream((filename + ".gz").c_str()));
     }
-    istream& is = streamPtr();
+    std::istream& is = streamPtr();
 
     if (!is.good())
     {
diff --git a/src/functionObjects/field/externalCoupled/externalCoupledTemplates.C b/src/functionObjects/field/externalCoupled/externalCoupledTemplates.C
index 504184bcf2a640e71e156aa916dafebb9e3bc65f..3a4a3633c4e32c6ffbe1cf45bbe625d89dce50f0 100644
--- a/src/functionObjects/field/externalCoupled/externalCoupledTemplates.C
+++ b/src/functionObjects/field/externalCoupled/externalCoupledTemplates.C
@@ -33,7 +33,7 @@ License
 #include "mixedFvPatchFields.H"
 #include "fixedGradientFvPatchFields.H"
 #include "fixedValueFvPatchFields.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 #include "globalIndex.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/nas/NASedgeFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/nas/NASedgeFormat.C
index 6eaab1996586221889342dc7532cf90fd9c4dc0d..7bd0acab4fa2964a9a74a731f01ee1533bffe90f 100644
--- a/src/meshTools/edgeMesh/edgeMeshFormats/nas/NASedgeFormat.C
+++ b/src/meshTools/edgeMesh/edgeMeshFormats/nas/NASedgeFormat.C
@@ -25,7 +25,7 @@ License
 
 #include "NASedgeFormat.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "PackedBoolList.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C
index e7441e160ae8693958ba1f3a3ac86405787f2cd7..1261b971cf1e1feb7a47840d45066d564a294601 100644
--- a/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C
+++ b/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C
@@ -26,7 +26,7 @@ License
 #include "OBJedgeFormat.H"
 #include "clock.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "Ostream.H"
 #include "OFstream.H"
 #include "ListOps.H"
diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/starcd/STARCDedgeFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/starcd/STARCDedgeFormat.C
index 39b16d7ccb4abf02b07becb8355e11031ad4686d..3282ee24d4b5aa3650fc03bbe769065cda63b687 100644
--- a/src/meshTools/edgeMesh/edgeMeshFormats/starcd/STARCDedgeFormat.C
+++ b/src/meshTools/edgeMesh/edgeMeshFormats/starcd/STARCDedgeFormat.C
@@ -27,7 +27,7 @@ License
 #include "ListOps.H"
 #include "clock.H"
 #include "PackedBoolList.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
diff --git a/src/meshTools/output/foamVtkWriteCellSetFaces.C b/src/meshTools/output/foamVtkWriteCellSetFaces.C
index a84b5d5b7068d508da4c3433364cbef5b60fb9d9..18c350629fed4fcec5e6e0a68a254ea16bd61f0a 100644
--- a/src/meshTools/output/foamVtkWriteCellSetFaces.C
+++ b/src/meshTools/output/foamVtkWriteCellSetFaces.C
@@ -45,7 +45,7 @@ void Foam::vtk::writeCellSetFaces
 
     const bool legacy_(opts.legacy());
 
-    std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
+    std::ofstream os(baseName + (legacy_ ? ".vtk" : ".vtp"));
 
     autoPtr<vtk::formatter> format = opts.newFormatter(os);
 
diff --git a/src/meshTools/output/foamVtkWriteFaceSet.C b/src/meshTools/output/foamVtkWriteFaceSet.C
index 59c11329d4122d220a8915ed2cc825e63474a946..5f1e1695fb9e69597e799a53b1d143f224c8cfed 100644
--- a/src/meshTools/output/foamVtkWriteFaceSet.C
+++ b/src/meshTools/output/foamVtkWriteFaceSet.C
@@ -45,7 +45,7 @@ void Foam::vtk::writeFaceSet
 
     const bool legacy_(opts.legacy());
 
-    std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
+    std::ofstream os(baseName + (legacy_ ? ".vtk" : ".vtp"));
 
     autoPtr<vtk::formatter> format = opts.newFormatter(os);
 
diff --git a/src/meshTools/output/foamVtkWritePointSet.C b/src/meshTools/output/foamVtkWritePointSet.C
index 66cbfc8c4439d2902ce9131f1afce68a23878a99..0ad3b90047c8265a81ac72680bd3dd7e47baf0e2 100644
--- a/src/meshTools/output/foamVtkWritePointSet.C
+++ b/src/meshTools/output/foamVtkWritePointSet.C
@@ -44,7 +44,7 @@ void Foam::vtk::writePointSet
 
     const bool legacy_(opts.legacy());
 
-    std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
+    std::ofstream os(baseName + (legacy_ ? ".vtk" : ".vtp"));
 
     autoPtr<vtk::formatter> format = opts.newFormatter(os);
 
diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H
index 75c760341ab39505fb39a79a3af03fdc954816d8..04127d7a294c0c11c0be0b0955997d5db6d146c5 100644
--- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H
+++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H
@@ -37,6 +37,7 @@ SourceFiles
 
 #include "surfaceReader.H"
 #include "ensightReadFile.H"
+#include "StringStream.H"
 #include "Tuple2.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
index 660920dd42a506881b3794f5506da6a82acfb73b..2c058293e887891a9209bbe946f8587843c04c5f 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
@@ -30,7 +30,7 @@ License
 #include "ensightPartFaces.H"
 #include "ensightSerialOutput.H"
 #include "ensightPTraits.H"
-#include "OStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
index daa0e2c1f8acca4b085751892e3b475a68285e8c..8f9681a7dd65537ebbfcd8b3e43e39f6fe599ce9 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "AC3DsurfaceFormat.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "PrimitivePatch.H"
 #include "faceTraits.H"
 
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCore.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCore.C
index 3f309be57e415ef794d1022291bfb46dee7747f5..61081d176ed08bf278a075395862a8d1b12e23c4 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCore.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCore.C
@@ -26,7 +26,7 @@ License
 #include "AC3DsurfaceFormatCore.H"
 #include "clock.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCoreTemplates.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCoreTemplates.C
index e472ad6b6bef985942d2acc5ecf8aa39cd733fc7..d55d89e8a3040d4bd4f7392435f37d082fc41044 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCoreTemplates.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatCoreTemplates.C
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "AC3DsurfaceFormatCore.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
diff --git a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
index f2aa5b22ee3eaf1b1f7fa0d4fb11a20140e5c04b..65910225fca0c2dcdefc126f942358b8a8775fec 100644
--- a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
@@ -27,7 +27,7 @@ License
 #include "surfaceFormatsCore.H"
 #include "clock.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "OFstream.H"
 #include "faceTraits.H"
 
diff --git a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
index 55f941bf43fc63bb21060761959e620141c7e72e..7f64549e9c2dae03b7ff61ef66372e02261f2d13 100644
--- a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
@@ -25,7 +25,7 @@ License
 
 #include "NASsurfaceFormat.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "faceTraits.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
index db2036aa888e5204251393612833f53273b32bfe..708f7654e97b30e204fafe49f671603d074d54a9 100644
--- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
@@ -26,7 +26,7 @@ License
 #include "OBJsurfaceFormat.H"
 #include "clock.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "OFstream.H"
 #include "ListOps.H"
 #include "faceTraits.H"
diff --git a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
index 3146f01b990b6f9fcfbbe537433c0ca51f6e736d..80047476fda4bec3132b354f9e38a0fea7bcb249 100644
--- a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
@@ -26,7 +26,7 @@ License
 #include "OFFsurfaceFormat.H"
 #include "clock.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "faceTraits.H"
 #include "OFstream.H"
 
diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C
index a746232d18aafdcb371dcb74c7ed7f42828d17e6..a1ba96c0cc33bf00b7da67ac71d2a856a07176c1 100644
--- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormat.C
@@ -266,7 +266,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBinary
     const MeshedSurfaceProxy<Face>& surf
 )
 {
-    std::ofstream os(filename.c_str(), std::ios::binary);
+    std::ofstream os(filename, std::ios::binary);
     if (!os.good())
     {
         FatalErrorInFunction
@@ -381,7 +381,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBinary
     const UnsortedMeshedSurface<Face>& surf
 )
 {
-    std::ofstream os(filename.c_str(), std::ios::binary);
+    std::ofstream os(filename, std::ios::binary);
     if (!os.good())
     {
         FatalErrorInFunction
diff --git a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
index 8f473d11203f5553a5b6907b45814ec375eae1d2..97b4112f9b6a41104a5657fbc74987b708deeffb 100644
--- a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
+++ b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
@@ -26,7 +26,7 @@ License
 #include "TRIsurfaceFormat.H"
 #include "IFstream.H"
 #include "IOmanip.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "mergePoints.H"
 #include "Map.H"
 
diff --git a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C
index b7141105d6d5a0e974bd409778164c4b73cf9e22..94e60511d0addcdcf45304a927ef5b0e9e495bc0 100644
--- a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C
@@ -274,7 +274,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
 
     const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
 
-    std::ofstream os(filename.c_str());
+    std::ofstream os(filename);
 
     autoPtr<vtk::formatter> format =
         vtk::newFormatter(os, fmtType);
@@ -332,7 +332,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
     const UnsortedMeshedSurface<Face>& surf
 )
 {
-    std::ofstream os(filename.c_str());
+    std::ofstream os(filename);
 
     autoPtr<vtk::formatter> format =
         vtk::newFormatter(os, fmtType);
diff --git a/src/surfMesh/surfaceFormats/vtp/VTPsurfaceFormat.C b/src/surfMesh/surfaceFormats/vtp/VTPsurfaceFormat.C
index edab56477518baca80b204c839c003f3513bc2f3..976672331381abe0392d8a63fc0b14b21e41c079 100644
--- a/src/surfMesh/surfaceFormats/vtp/VTPsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/vtp/VTPsurfaceFormat.C
@@ -133,7 +133,7 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
 
     const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
 
-    std::ofstream os(filename.c_str(), std::ios::binary);
+    std::ofstream os(filename, std::ios::binary);
 
     autoPtr<vtk::formatter> format =
         vtk::newFormatter(os, fmtType);
@@ -229,7 +229,7 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
     const UnsortedMeshedSurface<Face>& surf
 )
 {
-    std::ofstream os(filename.c_str(), std::ios::binary);
+    std::ofstream os(filename, std::ios::binary);
 
     autoPtr<vtk::formatter> format =
         vtk::newFormatter(os, fmtType);
diff --git a/src/surfMesh/triSurface/interfaces/AC3D/readAC.C b/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
index f17128756885fe36e7dc0fab3939355d78e2f689..a58f754113609f17baab3579a9fd78cff5c98086 100644
--- a/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
+++ b/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
@@ -30,7 +30,7 @@ Description
 
 #include "triSurface.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 #include "transform.H"
 #include "tensor.H"
 
diff --git a/src/surfMesh/triSurface/interfaces/GTS/readGTS.C b/src/surfMesh/triSurface/interfaces/GTS/readGTS.C
index d7394e2e0fd59536dee56bebb744b741d4fde1a0..666e9257401fd0f8a07f8462bc24fa935a46b1b8 100644
--- a/src/surfMesh/triSurface/interfaces/GTS/readGTS.C
+++ b/src/surfMesh/triSurface/interfaces/GTS/readGTS.C
@@ -25,7 +25,7 @@ License
 
 #include "triSurface.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
diff --git a/src/surfMesh/triSurface/interfaces/NAS/readNAS.C b/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
index ae55c60ca37df322cf937145351b660c19b096dd..42196867735262f0fa490b594916c71bd7ed69ef 100644
--- a/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
+++ b/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
@@ -37,7 +37,7 @@ Description
 
 #include "triSurface.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C b/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
index f13f1535bd29deb3c7c2f6815f3be7afc9f543a1..9a5f3fe4996eb3be29de0afc689055a6a22d6f46 100644
--- a/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
+++ b/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
@@ -25,7 +25,7 @@ License
 
 #include "triSurface.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
diff --git a/src/surfMesh/triSurface/interfaces/OFF/readOFF.C b/src/surfMesh/triSurface/interfaces/OFF/readOFF.C
index c846cab12e462c5801117df60987ad933777b94e..62a0dec6ea8cbc5f616e71062840de15a79fd543 100644
--- a/src/surfMesh/triSurface/interfaces/OFF/readOFF.C
+++ b/src/surfMesh/triSurface/interfaces/OFF/readOFF.C
@@ -28,7 +28,7 @@ Description
 
 #include "triSurface.H"
 #include "IFstream.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
diff --git a/src/surfMesh/triSurface/triSurface.C b/src/surfMesh/triSurface/triSurface.C
index 324c7913de7e80ce93780fdf15feed40c557f742..b9958febf44118e34872bb3b3edb2cb0cbbd294d 100644
--- a/src/surfMesh/triSurface/triSurface.C
+++ b/src/surfMesh/triSurface/triSurface.C
@@ -508,7 +508,7 @@ void Foam::triSurface::write
     }
     else if (ext == "stlb")
     {
-        std::ofstream outFile(name.c_str(), std::ios::binary);
+        std::ofstream outFile(name, std::ios::binary);
 
         writeSTLBINARY(outFile);
     }
@@ -526,7 +526,7 @@ void Foam::triSurface::write
     }
     else if (ext == "vtk")
     {
-        std::ofstream outFile(name.c_str(), std::ios::binary);
+        std::ofstream outFile(name, std::ios::binary);
         writeVTK(sort, outFile);
     }
     else if
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
index 5bbf9f0e40e9ed5546d69c936c9b6aff0d45c6ac..79eca025078e1a6d1b992314ad8e0f88fafff5c8 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
@@ -30,7 +30,7 @@ License
 #include "chemkinReader.H"
 
 #include "error.H"
-#include "IStringStream.H"
+#include "StringStream.H"
 // For EOF only
 #include <cstdio>
 
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
index af03c1bbe423162afe5c12aef8776ee8fa448b6b..3ee9572113b522b5bb67d3fbdb75ac5245a79487 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
@@ -782,9 +782,9 @@ void Foam::chemkinReader::read
 {
     transportDict_.read(IFstream(transportFileName)());
 
-    if (thermoFileName != fileName::null)
+    if (!thermoFileName.empty())
     {
-        std::ifstream thermoStream(thermoFileName.c_str());
+        std::ifstream thermoStream(thermoFileName);
 
         if (!thermoStream)
         {
@@ -804,7 +804,7 @@ void Foam::chemkinReader::read
         lineNo_ = 1;
     }
 
-    std::ifstream CHEMKINStream(CHEMKINFileName.c_str());
+    std::ifstream CHEMKINStream(CHEMKINFileName);
 
     if (!CHEMKINStream)
     {