You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/04/30 21:55:52 UTC
[13/45] lucenenet git commit: Moved all IO-related Support classes
into the Lucene.Net.Support.IO namespace.
Moved all IO-related Support classes into the Lucene.Net.Support.IO namespace.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/37901853
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/37901853
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/37901853
Branch: refs/heads/master
Commit: 37901853c0e6b4d945d3888b3c7dfba7ffc08fdb
Parents: 38d3a3d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Apr 28 12:04:44 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon May 1 04:45:04 2017 +0700
----------------------------------------------------------------------
.../Analysis/Hunspell/Dictionary.cs | 1 +
.../Egothor.Stemmer/Compile.cs | 1 +
.../Egothor.Stemmer/MultiTrie.cs | 2 +-
.../Egothor.Stemmer/MultiTrie2.cs | 2 +-
.../Egothor.Stemmer/Row.cs | 2 +-
.../Egothor.Stemmer/Trie.cs | 2 +-
.../Stempel/StempelStemmer.cs | 2 +-
.../Taxonomy/WriterCache/CharBlockArray.cs | 1 +
.../Classic/QueryParserTokenManager.cs | 2 +-
.../Parser/StandardSyntaxParserTokenManager.cs | 2 +-
.../Surround/Parser/QueryParserTokenManager.cs | 2 +-
.../Serialized/SerializedDVStrategy.cs | 2 +-
.../Suggest/Analyzing/AnalyzingSuggester.cs | 2 +-
.../Suggest/Fst/FSTCompletionLookup.cs | 2 +-
.../Suggest/SortedInputIterator.cs | 1 +
.../Suggest/SortedTermFreqIteratorWrapper.cs | 2 +-
.../Util/LuceneTestCase.cs | 24 +-
src/Lucene.Net.TestFramework/Util/TestUtil.cs | 24 +-
.../Egothor.Stemmer/TestCompile.cs | 1 +
.../Egothor.Stemmer/TestStemmer.cs | 21 -
.../Taxonomy/TestTaxonomyFacetCounts.cs | 37 +-
src/Lucene.Net.Tests/Index/TestCheckIndex.cs | 5 +-
.../Index/TestDocInverterPerFieldErrorInfo.cs | 7 +-
.../Index/TestIndexWriterDelete.cs | 13 +-
src/Lucene.Net.Tests/Lucene.Net.Tests.csproj | 8 +-
src/Lucene.Net.Tests/Support/IO/ReadFully.txt | 14 +
.../Support/IO/TestDataInputStream.cs | 267 ++++++++++++
.../Support/IO/TestDataOutputStream.cs | 194 +++++++++
.../Support/IO/TestSafeTextWriterWrapper.cs | 68 +++
src/Lucene.Net.Tests/Support/ReadFully.txt | 14 -
.../Support/TestDataInputStream.cs | 267 ------------
.../Support/TestDataOutputStream.cs | 194 ---------
.../Support/TestSafeTextWriterWrapper.cs | 68 ---
src/Lucene.Net.Tests/project.json | 2 +-
src/Lucene.Net/Index/CheckIndex.cs | 1 +
src/Lucene.Net/Index/SegmentInfos.cs | 1 +
src/Lucene.Net/Lucene.Net.csproj | 27 +-
src/Lucene.Net/Search/FieldCacheImpl.cs | 1 +
src/Lucene.Net/Support/ByteArrayOutputStream.cs | 40 --
.../Compatibility/BinaryReaderDataInput.cs | 50 ---
.../Compatibility/BinaryWriterDataOutput.cs | 47 ---
src/Lucene.Net/Support/DataInputStream.cs | 413 -------------------
src/Lucene.Net/Support/DataOutputStream.cs | 307 --------------
src/Lucene.Net/Support/Deflater.cs | 143 -------
src/Lucene.Net/Support/FileSupport.cs | 232 -----------
src/Lucene.Net/Support/IDataInput.cs | 73 ----
src/Lucene.Net/Support/IDataOutput.cs | 64 ---
.../Support/IO/BinaryReaderDataInput.cs | 50 +++
.../Support/IO/BinaryWriterDataOutput.cs | 47 +++
.../Support/IO/ByteArrayOutputStream.cs | 40 ++
.../Support/IO/Compression/Deflater.cs | 143 +++++++
.../Support/IO/Compression/Inflater.cs | 115 ++++++
.../Support/IO/Compression/SharpZipLib.cs | 53 +++
src/Lucene.Net/Support/IO/DataInputStream.cs | 413 +++++++++++++++++++
src/Lucene.Net/Support/IO/DataOutputStream.cs | 307 ++++++++++++++
src/Lucene.Net/Support/IO/FileSupport.cs | 232 +++++++++++
src/Lucene.Net/Support/IO/IDataInput.cs | 73 ++++
src/Lucene.Net/Support/IO/IDataOutput.cs | 64 +++
.../Support/IO/SafeTextWriterWrapper.cs | 387 +++++++++++++++++
src/Lucene.Net/Support/IO/StreamUtils.cs | 51 +++
src/Lucene.Net/Support/Inflater.cs | 115 ------
src/Lucene.Net/Support/SafeTextWriterWrapper.cs | 387 -----------------
src/Lucene.Net/Support/SharpZipLib.cs | 53 ---
src/Lucene.Net/Support/StreamUtils.cs | 51 ---
src/Lucene.Net/Util/OfflineSorter.cs | 2 +-
65 files changed, 2612 insertions(+), 2626 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
index 56b10da..0c7c8c1 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Store;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using Lucene.Net.Util.Automaton;
using Lucene.Net.Util.Fst;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
index 9d88aae..a6d8315 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
@@ -1,4 +1,5 @@
\ufeffusing Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.IO;
using System.Text;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs
index 373bac5..84b9704 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System.Collections.Generic;
using System.IO;
using System.Text;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie2.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie2.cs
index 8d8568e..cdc9f7d 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie2.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie2.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System;
using System.Collections.Generic;
using System.Text;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
index a11dc52..149b8e2 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System.Collections.Generic;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs
index da9818f..b0378d1 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System.Collections.Generic;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Analysis.Stempel/Stempel/StempelStemmer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Stempel/StempelStemmer.cs b/src/Lucene.Net.Analysis.Stempel/Stempel/StempelStemmer.cs
index 43e544a..8ce7548 100644
--- a/src/Lucene.Net.Analysis.Stempel/Stempel/StempelStemmer.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Stempel/StempelStemmer.cs
@@ -1,5 +1,5 @@
\ufeffusing Egothor.Stemmer;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System.IO;
using System.Text;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs
index 374ecf0..365bb95 100644
--- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Store;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.Collections.Generic;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs
index b8f2c17..f9e8813 100644
--- a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs
+++ b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
index e04feef..c775c4b 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs
index aaa67f1..8f3800b 100644
--- a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs
+++ b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Support;
+\ufeffusing Lucene.Net.Support.IO;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
index 0f68c8d..247cc8f 100644
--- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
+++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
@@ -4,7 +4,7 @@ using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
using Lucene.Net.Spatial.Queries;
using Lucene.Net.Spatial.Util;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using Spatial4n.Core.Context;
using Spatial4n.Core.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
index 74d1106..8c58e5a 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
@@ -1,6 +1,6 @@
\ufeffusing Lucene.Net.Analysis;
using Lucene.Net.Store;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using Lucene.Net.Util.Automaton;
using Lucene.Net.Util.Fst;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
index 49eb6cb..417b73d 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
@@ -1,5 +1,5 @@
\ufeffusing Lucene.Net.Store;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using Lucene.Net.Util.Fst;
using System;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs b/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs
index f1016ac..19ff0b7 100644
--- a/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs
+++ b/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Store;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using System.Collections.Generic;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs b/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs
index f808890..3af48e7 100644
--- a/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs
+++ b/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs
@@ -1,6 +1,6 @@
\ufeffusing Lucene.Net.Search.Spell;
using Lucene.Net.Store;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using System.Collections.Generic;
using System.IO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index d16f04a..146ae94 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -15,8 +15,6 @@
* limitations under the License.
*/
-using System.Collections.Concurrent;
-using System.Runtime.CompilerServices;
using Lucene.Net.Analysis.Util;
using Lucene.Net.Codecs;
using Lucene.Net.Documents;
@@ -25,22 +23,28 @@ using Lucene.Net.Randomized;
using Lucene.Net.Randomized.Generators;
using Lucene.Net.Search;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using Lucene.Net.TestFramework.Support;
using Lucene.Net.Util.Automaton;
using NUnit.Framework;
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
-using System.Threading.Tasks;
+using System.IO;
using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
namespace Lucene.Net.Util
{
- using Lucene.Net.TestFramework.Support;
- using System.IO;
- using System.Reflection;
+ using Analysis;
+ using Attributes;
+ using Search.Similarities;
+ using System.Linq;
+ using System.Text.RegularExpressions;
using AlcoholicMergePolicy = Lucene.Net.Index.AlcoholicMergePolicy;
-
using Analyzer = Lucene.Net.Analysis.Analyzer;
using AssertingAtomicReader = Lucene.Net.Index.AssertingAtomicReader;
using AssertingDirectoryReader = Lucene.Net.Index.AssertingDirectoryReader;
@@ -75,7 +79,6 @@ namespace Lucene.Net.Util
using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
using Insanity = Lucene.Net.Util.FieldCacheSanityChecker.Insanity;
using IOContext = Lucene.Net.Store.IOContext;
-
//using Context = Lucene.Net.Store.IOContext.Context;
using LockFactory = Lucene.Net.Store.LockFactory;
using LogByteSizeMergePolicy = Lucene.Net.Index.LogByteSizeMergePolicy;
@@ -104,11 +107,6 @@ namespace Lucene.Net.Util
using TermsEnum = Lucene.Net.Index.TermsEnum;
using TextField = TextField;
using TieredMergePolicy = Lucene.Net.Index.TieredMergePolicy;
- using Analysis;
- using Search.Similarities;
- using System.Linq;
- using System.Text.RegularExpressions;
- using Attributes;
/*using After = org.junit.After;
using AfterClass = org.junit.AfterClass;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.TestFramework/Util/TestUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index e7517ff..e7eb247 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -1,27 +1,27 @@
-using System.Numerics;
using Lucene.Net.Documents;
using Lucene.Net.Index;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using NUnit.Framework;
using System;
using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
using System.Linq;
+using System.Numerics;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Lucene.Net.Util
{
- using Lucene.Net.Randomized.Generators;
- using Lucene.Net.Support;
-
//using RandomInts = com.carrotsearch.randomizedtesting.generators.RandomInts;
//using RandomPicks = com.carrotsearch.randomizedtesting.generators.RandomPicks;
- using NUnit.Framework;
- using System.IO;
- using System.IO.Compression;
- using System.Text.RegularExpressions;
+
using AtomicReader = Lucene.Net.Index.AtomicReader;
using AtomicReaderContext = Lucene.Net.Index.AtomicReaderContext;
using BinaryDocValuesField = BinaryDocValuesField;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -40,7 +40,6 @@ namespace Lucene.Net.Util
*/
using Codec = Lucene.Net.Codecs.Codec;
-
//using CheckIndex = Lucene.Net.Index.CheckIndex;
using Directory = Lucene.Net.Store.Directory;
using DocsAndPositionsEnum = Lucene.Net.Index.DocsAndPositionsEnum;
@@ -53,13 +52,12 @@ namespace Lucene.Net.Util
using FieldDoc = Lucene.Net.Search.FieldDoc;
using FieldType = FieldType;
using FilteredQuery = Lucene.Net.Search.FilteredQuery;
- using SingleField = SingleField;
using IIndexableField = Lucene.Net.Index.IIndexableField;
using IndexReader = Lucene.Net.Index.IndexReader;
using IndexWriter = Lucene.Net.Index.IndexWriter;
using Int32Field = Int32Field;
- using LogMergePolicy = Lucene.Net.Index.LogMergePolicy;
using Int64Field = Int64Field;
+ using LogMergePolicy = Lucene.Net.Index.LogMergePolicy;
using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
using MergePolicy = Lucene.Net.Index.MergePolicy;
using MergeScheduler = Lucene.Net.Index.MergeScheduler;
@@ -69,12 +67,12 @@ namespace Lucene.Net.Util
using PerFieldPostingsFormat = Lucene.Net.Codecs.PerField.PerFieldPostingsFormat;
using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
using ScoreDoc = Lucene.Net.Search.ScoreDoc;
+ using SingleField = SingleField;
using SortedDocValuesField = SortedDocValuesField;
using Terms = Lucene.Net.Index.Terms;
using TermsEnum = Lucene.Net.Index.TermsEnum;
using TieredMergePolicy = Lucene.Net.Index.TieredMergePolicy;
using TopDocs = Lucene.Net.Search.TopDocs;
- using Codecs;
/// <summary>
/// General utility methods for Lucene unit tests.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
index 50717bc..52ac16f 100644
--- a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
+++ b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
@@ -21,6 +21,7 @@
using Lucene.Net;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using NUnit.Framework;
using System;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestStemmer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestStemmer.cs b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestStemmer.cs
index d64225b..8c2099d 100644
--- a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestStemmer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestStemmer.cs
@@ -1,24 +1,3 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
using Lucene.Net.Util;
using NUnit.Framework;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
index bee018c..705b476 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
@@ -1,11 +1,12 @@
-\ufeffusing System;
+\ufeffusing Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using NUnit.Framework;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Lucene.Net.Randomized.Generators;
-using Lucene.Net.Support;
-using NUnit.Framework;
namespace Lucene.Net.Facet.Taxonomy
{
@@ -28,30 +29,30 @@ namespace Lucene.Net.Facet.Taxonomy
*/
- using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
- using Document = Lucene.Net.Documents.Document;
- using Field = Lucene.Net.Documents.Field;
- using StringField = Lucene.Net.Documents.StringField;
+ using System.Text;
+ using DefaultSimilarity = Lucene.Net.Search.Similarities.DefaultSimilarity;
+ using Directory = Lucene.Net.Store.Directory;
+ using DirectoryReader = Lucene.Net.Index.DirectoryReader;
using DirectoryTaxonomyReader = Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader;
using DirectoryTaxonomyWriter = Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyWriter;
- using DirectoryReader = Lucene.Net.Index.DirectoryReader;
+ using Document = Lucene.Net.Documents.Document;
+ using Field = Lucene.Net.Documents.Field;
+ using IndexSearcher = Lucene.Net.Search.IndexSearcher;
using IndexWriter = Lucene.Net.Index.IndexWriter;
using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
+ using IOUtils = Lucene.Net.Util.IOUtils;
+ using MatchAllDocsQuery = Lucene.Net.Search.MatchAllDocsQuery;
+ using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
using NoMergePolicy = Lucene.Net.Index.NoMergePolicy;
using OpenMode = Lucene.Net.Index.OpenMode;
+ using PerFieldSimilarityWrapper = Lucene.Net.Search.Similarities.PerFieldSimilarityWrapper;
+ using Query = Lucene.Net.Search.Query;
using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+ using Similarity = Lucene.Net.Search.Similarities.Similarity;
+ using StringField = Lucene.Net.Documents.StringField;
using Term = Lucene.Net.Index.Term;
- using IndexSearcher = Lucene.Net.Search.IndexSearcher;
- using MatchAllDocsQuery = Lucene.Net.Search.MatchAllDocsQuery;
- using Query = Lucene.Net.Search.Query;
using TermQuery = Lucene.Net.Search.TermQuery;
- using DefaultSimilarity = Lucene.Net.Search.Similarities.DefaultSimilarity;
- using PerFieldSimilarityWrapper = Lucene.Net.Search.Similarities.PerFieldSimilarityWrapper;
- using Similarity = Lucene.Net.Search.Similarities.Similarity;
- using Directory = Lucene.Net.Store.Directory;
- using IOUtils = Lucene.Net.Util.IOUtils;
using TestUtil = Lucene.Net.Util.TestUtil;
- using System.Text;
[TestFixture]
public class TestTaxonomyFacetCounts : FacetTestCase
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
index 7b6186e..2ec030a 100644
--- a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
+++ b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
@@ -1,13 +1,14 @@
using Lucene.Net.Documents;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using NUnit.Framework;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Text;
namespace Lucene.Net.Index
{
- using NUnit.Framework;
- using System.IO;
using CannedTokenStream = Lucene.Net.Analysis.CannedTokenStream;
using Directory = Lucene.Net.Store.Directory;
using Document = Documents.Document;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
index 770274c..64ed379 100644
--- a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
@@ -1,14 +1,13 @@
using Lucene.Net.Analysis;
using Lucene.Net.Documents;
-using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using NUnit.Framework;
using System;
+using System.IO;
using System.Text;
namespace Lucene.Net.Index
{
- using NUnit.Framework;
- using System.IO;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
index 479f787..595f040 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
@@ -1,16 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.Threading;
using Lucene.Net.Analysis;
using Lucene.Net.Attributes;
using Lucene.Net.Documents;
using Lucene.Net.Randomized.Generators;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
+using Lucene.Net.Util;
using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
-using Lucene.Net.Util;
+using System.Text;
+using System.Threading;
namespace Lucene.Net.Index
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index c8d7257..492a503 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -529,11 +529,11 @@
<Compile Include="Support\IO\TestByteBuffer.cs" />
<Compile Include="Support\TestLurchTable.cs" />
<Compile Include="Support\TestLurchTableThreading.cs" />
- <Compile Include="Support\TestDataInputStream.cs" />
- <Compile Include="Support\TestDataOutputStream.cs" />
+ <Compile Include="Support\IO\TestDataInputStream.cs" />
+ <Compile Include="Support\IO\TestDataOutputStream.cs" />
<Compile Include="Support\TestOldPatches.cs" />
<Compile Include="Support\TestOSClass.cs" />
- <Compile Include="Support\TestSafeTextWriterWrapper.cs" />
+ <Compile Include="Support\IO\TestSafeTextWriterWrapper.cs" />
<Compile Include="Support\TestSerialization.cs" />
<Compile Include="Support\TestStringBuilderExtensions.cs" />
<Compile Include="Support\TestCRC32.cs" />
@@ -747,7 +747,7 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="Support\ReadFully.txt" />
+ <EmbeddedResource Include="Support\IO\ReadFully.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/IO/ReadFully.txt
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/IO/ReadFully.txt b/src/Lucene.Net.Tests/Support/IO/ReadFully.txt
new file mode 100644
index 0000000..ad76b7a
--- /dev/null
+++ b/src/Lucene.Net.Tests/Support/IO/ReadFully.txt
@@ -0,0 +1,14 @@
+\ufeffLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
+sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
+sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
+sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/IO/TestDataInputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/IO/TestDataInputStream.cs b/src/Lucene.Net.Tests/Support/IO/TestDataInputStream.cs
new file mode 100644
index 0000000..1432089
--- /dev/null
+++ b/src/Lucene.Net.Tests/Support/IO/TestDataInputStream.cs
@@ -0,0 +1,267 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+using Lucene.Net.Attributes;
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace Lucene.Net.Support.IO
+{
+ public class TestDataInputStream : LuceneTestCase
+ {
+ [Test, LuceneNetSpecific]
+ public void TestReadFully()
+ {
+ const string READFULLY_TEST_FILE = "ReadFully.txt";
+ int fileLength;
+ Stream @in;
+
+ // Read one time to measure the length of the file (it may be different
+ // on different operating systems because of line endings)
+ using (@in = GetType().getResourceAsStream(READFULLY_TEST_FILE))
+ {
+ using (var ms = new MemoryStream())
+ {
+ @in.CopyTo(ms);
+ fileLength = ms.ToArray().Length;
+ }
+ }
+
+ // Declare the buffer one byte too large
+ byte[] buffer = new byte[fileLength + 1];
+ @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
+ DataInputStream dis;
+ using (dis = new DataInputStream(@in))
+ {
+ // Read once for real (to the exact length)
+ dis.ReadFully(buffer, 0, fileLength);
+ }
+
+ // Read past the end of the stream
+ @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
+ dis = new DataInputStream(@in);
+ bool caughtException = false;
+ try
+ {
+ // Using the buffer length (that is 1 byte too many)
+ // should generate EndOfStreamException.
+ dis.ReadFully(buffer, 0, buffer.Length);
+ }
+#pragma warning disable 168
+ catch (EndOfStreamException ie)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ dis.Dispose();
+ if (!caughtException)
+ fail("Test failed");
+ }
+
+ // Ensure we get an IndexOutOfRangeException exception when length is negative
+ @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
+ dis = new DataInputStream(@in);
+ caughtException = false;
+ try
+ {
+ dis.ReadFully(buffer, 0, -20);
+ }
+#pragma warning disable 168
+ catch (IndexOutOfRangeException ie)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ dis.Dispose();
+ if (!caughtException)
+ fail("Test failed");
+ }
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestReadLinePushback()
+ {
+ using (MemoryStream pis = new MemoryStream("\r".GetBytes(Encoding.UTF8)))
+ {
+ DataInputStream dis = new DataInputStream(pis);
+
+#pragma warning disable 612, 618
+ string line = dis.ReadLine();
+#pragma warning restore 612, 618
+ if (line == null)
+ {
+ fail("Got null, should return empty line");
+ }
+
+ long count = pis.Length - (line.Length + 1 /*account for the newline*/);
+
+ if (count != 0)
+ {
+ fail("Test failed: available() returns "
+ + count + " when the file is empty");
+ }
+ }
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestReadUTF()
+ {
+ for (int i = 0; i < TEST_ITERATIONS; i++)
+ {
+ try
+ {
+ WriteAndReadAString();
+ }
+ catch (FormatException utfdfe)
+ {
+ if (utfdfe.Message == null)
+ fail("vague exception thrown");
+ }
+#pragma warning disable 168
+ catch (EndOfStreamException eofe)
+#pragma warning restore 168
+ {
+ // These are rare and beyond the scope of the test
+ }
+ }
+ }
+
+
+ private static readonly int TEST_ITERATIONS = 1000;
+
+ private static readonly int A_NUMBER_NEAR_65535 = 60000;
+
+ private static readonly int MAX_CORRUPTIONS_PER_CYCLE = 3;
+
+ private static void WriteAndReadAString()
+ {
+ // Write out a string whose UTF-8 encoding is quite possibly
+ // longer than 65535 bytes
+ int length = Random().nextInt(A_NUMBER_NEAR_65535) + 1;
+ MemoryStream baos = new MemoryStream();
+ StringBuilder testBuffer = new StringBuilder();
+ for (int i = 0; i < length; i++)
+ testBuffer.append((char)Random().Next());
+ string testString = testBuffer.toString();
+ DataOutputStream dos = new DataOutputStream(baos);
+ dos.WriteUTF(testString);
+
+ // Corrupt the data to produce malformed characters
+ byte[] testBytes = baos.ToArray();
+ int dataLength = testBytes.Length;
+ int corruptions = Random().nextInt(MAX_CORRUPTIONS_PER_CYCLE);
+ for (int i = 0; i < corruptions; i++)
+ {
+ int index = Random().nextInt(dataLength);
+ testBytes[index] = (byte)Random().Next();
+ }
+
+ // Pay special attention to mangling the end to produce
+ // partial characters at end
+ testBytes[dataLength - 1] = (byte)Random().Next();
+ testBytes[dataLength - 2] = (byte)Random().Next();
+
+ // Attempt to decode the bytes back into a String
+ MemoryStream bais = new MemoryStream(testBytes);
+ DataInputStream dis = new DataInputStream(bais);
+ dis.ReadUTF();
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestSkipBytes()
+ {
+ DataInputStream dis = new DataInputStream(new MyInputStream());
+ dotest(dis, 0, 11, -1, 0);
+ dotest(dis, 0, 11, 5, 5);
+ Console.WriteLine("\n***CAUTION**** - may go into an infinite loop");
+ dotest(dis, 5, 11, 20, 6);
+ }
+
+
+ private static void dotest(DataInputStream dis, int pos, int total,
+ int toskip, int expected)
+ {
+
+ try
+ {
+ if (VERBOSE)
+ {
+ Console.WriteLine("\n\nTotal bytes in the stream = " + total);
+ Console.WriteLine("Currently at position = " + pos);
+ Console.WriteLine("Bytes to skip = " + toskip);
+ Console.WriteLine("Expected result = " + expected);
+ }
+ int skipped = dis.SkipBytes(toskip);
+ if (VERBOSE)
+ {
+ Console.WriteLine("Actual skipped = " + skipped);
+ }
+ if (skipped != expected)
+ {
+ fail("DataInputStream.skipBytes does not return expected value");
+ }
+ }
+#pragma warning disable 168
+ catch (EndOfStreamException e)
+#pragma warning restore 168
+ {
+ fail("DataInputStream.skipBytes throws unexpected EOFException");
+ }
+#pragma warning disable 168
+ catch (IOException e)
+#pragma warning restore 168
+ {
+ Console.WriteLine("IOException is thrown - possible result");
+ }
+ }
+
+ internal class MyInputStream : MemoryStream
+ {
+
+ private int readctr = 0;
+
+
+ public override int ReadByte()
+ {
+
+ if (readctr > 10)
+ {
+ return -1;
+ }
+ else
+ {
+ readctr++;
+ return 0;
+ }
+
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/IO/TestDataOutputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/IO/TestDataOutputStream.cs b/src/Lucene.Net.Tests/Support/IO/TestDataOutputStream.cs
new file mode 100644
index 0000000..ab80b6b
--- /dev/null
+++ b/src/Lucene.Net.Tests/Support/IO/TestDataOutputStream.cs
@@ -0,0 +1,194 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+using Lucene.Net.Attributes;
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace Lucene.Net.Support.IO
+{
+ public class TestDataOutputStream : LuceneTestCase
+ {
+ [Test, LuceneNetSpecific]
+ public void TestCounterOverflow()
+ {
+ var output = new MemoryStream();
+ CounterOverflow dataOut = new CounterOverflow(output);
+
+ dataOut.WriteByte(1);
+ if (dataOut.Length < 0)
+ {
+ fail("Internal counter less than 0.");
+ }
+ }
+
+ private class CounterOverflow : DataOutputStream
+ {
+ public CounterOverflow(Stream output)
+ : base(output)
+ {
+ base.written = int.MaxValue;
+ }
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestWriteUTF()
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ dos.WriteUTF("Hello, World!"); // 15
+ dos.Flush();
+ if (baos.Length != dos.Length)
+ fail("Miscounted bytes in DataOutputStream.");
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestBoundsCheck()
+ {
+ byte[] data = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ DummyFilterStream dfs = new DummyFilterStream(bos);
+ bool caughtException = false;
+
+ // -ve length
+ try
+ {
+ dfs.Write(data, 0, -5);
+ }
+#pragma warning disable 168
+ catch (ArgumentOutOfRangeException ie)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ if (!caughtException)
+ fail("Test failed");
+ }
+
+ // -ve offset
+ caughtException = false;
+ try
+ {
+ dfs.Write(data, -2, 5);
+ }
+#pragma warning disable 168
+ catch (ArgumentOutOfRangeException ie)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ if (!caughtException)
+ fail("Test failed");
+ }
+
+ // off + len > data.length
+ caughtException = false;
+ try
+ {
+ dfs.Write(data, 6, 5);
+ }
+#pragma warning disable 168
+ catch (ArgumentException ie)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ if (!caughtException)
+ fail("Test failed");
+ }
+
+ // null data
+ caughtException = false;
+ try
+ {
+ dfs.Write(null, 0, 5);
+ }
+#pragma warning disable 168
+ catch (ArgumentNullException re)
+#pragma warning restore 168
+ {
+ caughtException = true;
+ }
+ finally
+ {
+ if (!caughtException)
+ fail("Test failed");
+ }
+ }
+
+ private class DummyFilterStream : DataOutputStream
+ {
+
+ public DummyFilterStream(Stream o)
+ : base(o)
+ {
+ }
+
+ public override void Write(int val)
+ {
+ base.Write(val + 1);
+ }
+ }
+
+ [Test, LuceneNetSpecific]
+ public void TestWrite()
+ {
+ IDataOutput f = new F(new Sink());
+ f.Write(new byte[] { 1, 2, 3 }, 0, 3);
+ }
+
+ private class F : DataOutputStream
+ {
+
+ public F(Stream o)
+ : base(o)
+ {
+ }
+
+ public override void Write(int b)
+ {
+ Debug.WriteLine("Ignoring write of " + b);
+ }
+
+ }
+
+ private class Sink : MemoryStream
+ {
+
+ public override void WriteByte(byte b)
+ {
+ throw new Exception("DataOutputStream directly invoked"
+ + " Write(byte) method of underlying"
+ + " stream");
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/IO/TestSafeTextWriterWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/IO/TestSafeTextWriterWrapper.cs b/src/Lucene.Net.Tests/Support/IO/TestSafeTextWriterWrapper.cs
new file mode 100644
index 0000000..747db08
--- /dev/null
+++ b/src/Lucene.Net.Tests/Support/IO/TestSafeTextWriterWrapper.cs
@@ -0,0 +1,68 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace Lucene.Net.Support.IO
+{
+ public class TestSafeTextWriterWrapper : LuceneTestCase
+ {
+ [Test]
+ public void TestWrite()
+ {
+ SafeTextWriterWrapper safe;
+ using (TextWriter wrapped = new StringWriter())
+ {
+ safe = new SafeTextWriterWrapper(wrapped);
+
+ safe.Write('a');
+ assertEquals("a", wrapped.ToString());
+ }
+
+ Assert.DoesNotThrow(() => safe.Write('a'));
+ Assert.DoesNotThrow(() => safe.Write('a'));
+ Assert.DoesNotThrow(() => safe.Write("a"));
+ }
+
+ [Test]
+ public void TestWriteLine()
+ {
+ SafeTextWriterWrapper safe;
+ using (TextWriter wrapped = new StringWriter())
+ {
+ safe = new SafeTextWriterWrapper(wrapped);
+
+ safe.WriteLine('a');
+ assertEquals("a" + Environment.NewLine, wrapped.ToString());
+
+ safe.WriteLine("This is a test");
+ assertEquals("a" + Environment.NewLine + "This is a test" + Environment.NewLine, wrapped.ToString());
+ }
+
+ Assert.DoesNotThrow(() => safe.WriteLine('a'));
+ Assert.DoesNotThrow(() => safe.WriteLine("Testing"));
+ Assert.DoesNotThrow(() => safe.WriteLine("Testing"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/ReadFully.txt
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/ReadFully.txt b/src/Lucene.Net.Tests/Support/ReadFully.txt
deleted file mode 100644
index ad76b7a..0000000
--- a/src/Lucene.Net.Tests/Support/ReadFully.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-\ufeffLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
-aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
-sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
-aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
-sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
-aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
-sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/TestDataInputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/TestDataInputStream.cs b/src/Lucene.Net.Tests/Support/TestDataInputStream.cs
deleted file mode 100644
index e51eef9..0000000
--- a/src/Lucene.Net.Tests/Support/TestDataInputStream.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-using Lucene.Net.Attributes;
-using Lucene.Net.Util;
-using NUnit.Framework;
-using System;
-using System.IO;
-using System.Reflection;
-using System.Text;
-
-namespace Lucene.Net.Support
-{
- public class TestDataInputStream : LuceneTestCase
- {
- [Test, LuceneNetSpecific]
- public void TestReadFully()
- {
- const string READFULLY_TEST_FILE = "ReadFully.txt";
- int fileLength;
- Stream @in;
-
- // Read one time to measure the length of the file (it may be different
- // on different operating systems because of line endings)
- using (@in = GetType().getResourceAsStream(READFULLY_TEST_FILE))
- {
- using (var ms = new MemoryStream())
- {
- @in.CopyTo(ms);
- fileLength = ms.ToArray().Length;
- }
- }
-
- // Declare the buffer one byte too large
- byte[] buffer = new byte[fileLength + 1];
- @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
- DataInputStream dis;
- using (dis = new DataInputStream(@in))
- {
- // Read once for real (to the exact length)
- dis.ReadFully(buffer, 0, fileLength);
- }
-
- // Read past the end of the stream
- @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
- dis = new DataInputStream(@in);
- bool caughtException = false;
- try
- {
- // Using the buffer length (that is 1 byte too many)
- // should generate EndOfStreamException.
- dis.ReadFully(buffer, 0, buffer.Length);
- }
-#pragma warning disable 168
- catch (EndOfStreamException ie)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- dis.Dispose();
- if (!caughtException)
- fail("Test failed");
- }
-
- // Ensure we get an IndexOutOfRangeException exception when length is negative
- @in = GetType().getResourceAsStream(READFULLY_TEST_FILE);
- dis = new DataInputStream(@in);
- caughtException = false;
- try
- {
- dis.ReadFully(buffer, 0, -20);
- }
-#pragma warning disable 168
- catch (IndexOutOfRangeException ie)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- dis.Dispose();
- if (!caughtException)
- fail("Test failed");
- }
- }
-
- [Test, LuceneNetSpecific]
- public void TestReadLinePushback()
- {
- using (MemoryStream pis = new MemoryStream("\r".GetBytes(Encoding.UTF8)))
- {
- DataInputStream dis = new DataInputStream(pis);
-
-#pragma warning disable 612, 618
- string line = dis.ReadLine();
-#pragma warning restore 612, 618
- if (line == null)
- {
- fail("Got null, should return empty line");
- }
-
- long count = pis.Length - (line.Length + 1 /*account for the newline*/);
-
- if (count != 0)
- {
- fail("Test failed: available() returns "
- + count + " when the file is empty");
- }
- }
- }
-
- [Test, LuceneNetSpecific]
- public void TestReadUTF()
- {
- for (int i = 0; i < TEST_ITERATIONS; i++)
- {
- try
- {
- WriteAndReadAString();
- }
- catch (FormatException utfdfe)
- {
- if (utfdfe.Message == null)
- fail("vague exception thrown");
- }
-#pragma warning disable 168
- catch (EndOfStreamException eofe)
-#pragma warning restore 168
- {
- // These are rare and beyond the scope of the test
- }
- }
- }
-
-
- private static readonly int TEST_ITERATIONS = 1000;
-
- private static readonly int A_NUMBER_NEAR_65535 = 60000;
-
- private static readonly int MAX_CORRUPTIONS_PER_CYCLE = 3;
-
- private static void WriteAndReadAString()
- {
- // Write out a string whose UTF-8 encoding is quite possibly
- // longer than 65535 bytes
- int length = Random().nextInt(A_NUMBER_NEAR_65535) + 1;
- MemoryStream baos = new MemoryStream();
- StringBuilder testBuffer = new StringBuilder();
- for (int i = 0; i < length; i++)
- testBuffer.append((char)Random().Next());
- string testString = testBuffer.toString();
- DataOutputStream dos = new DataOutputStream(baos);
- dos.WriteUTF(testString);
-
- // Corrupt the data to produce malformed characters
- byte[] testBytes = baos.ToArray();
- int dataLength = testBytes.Length;
- int corruptions = Random().nextInt(MAX_CORRUPTIONS_PER_CYCLE);
- for (int i = 0; i < corruptions; i++)
- {
- int index = Random().nextInt(dataLength);
- testBytes[index] = (byte)Random().Next();
- }
-
- // Pay special attention to mangling the end to produce
- // partial characters at end
- testBytes[dataLength - 1] = (byte)Random().Next();
- testBytes[dataLength - 2] = (byte)Random().Next();
-
- // Attempt to decode the bytes back into a String
- MemoryStream bais = new MemoryStream(testBytes);
- DataInputStream dis = new DataInputStream(bais);
- dis.ReadUTF();
- }
-
- [Test, LuceneNetSpecific]
- public void TestSkipBytes()
- {
- DataInputStream dis = new DataInputStream(new MyInputStream());
- dotest(dis, 0, 11, -1, 0);
- dotest(dis, 0, 11, 5, 5);
- Console.WriteLine("\n***CAUTION**** - may go into an infinite loop");
- dotest(dis, 5, 11, 20, 6);
- }
-
-
- private static void dotest(DataInputStream dis, int pos, int total,
- int toskip, int expected)
- {
-
- try
- {
- if (VERBOSE)
- {
- Console.WriteLine("\n\nTotal bytes in the stream = " + total);
- Console.WriteLine("Currently at position = " + pos);
- Console.WriteLine("Bytes to skip = " + toskip);
- Console.WriteLine("Expected result = " + expected);
- }
- int skipped = dis.SkipBytes(toskip);
- if (VERBOSE)
- {
- Console.WriteLine("Actual skipped = " + skipped);
- }
- if (skipped != expected)
- {
- fail("DataInputStream.skipBytes does not return expected value");
- }
- }
-#pragma warning disable 168
- catch (EndOfStreamException e)
-#pragma warning restore 168
- {
- fail("DataInputStream.skipBytes throws unexpected EOFException");
- }
-#pragma warning disable 168
- catch (IOException e)
-#pragma warning restore 168
- {
- Console.WriteLine("IOException is thrown - possible result");
- }
- }
-
- internal class MyInputStream : MemoryStream
- {
-
- private int readctr = 0;
-
-
- public override int ReadByte()
- {
-
- if (readctr > 10)
- {
- return -1;
- }
- else
- {
- readctr++;
- return 0;
- }
-
- }
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/TestDataOutputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/TestDataOutputStream.cs b/src/Lucene.Net.Tests/Support/TestDataOutputStream.cs
deleted file mode 100644
index d9ea977..0000000
--- a/src/Lucene.Net.Tests/Support/TestDataOutputStream.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-using Lucene.Net.Attributes;
-using Lucene.Net.Util;
-using NUnit.Framework;
-using System;
-using System.Diagnostics;
-using System.IO;
-
-namespace Lucene.Net.Support
-{
- public class TestDataOutputStream : LuceneTestCase
- {
- [Test, LuceneNetSpecific]
- public void TestCounterOverflow()
- {
- var output = new MemoryStream();
- CounterOverflow dataOut = new CounterOverflow(output);
-
- dataOut.WriteByte(1);
- if (dataOut.Length < 0)
- {
- fail("Internal counter less than 0.");
- }
- }
-
- private class CounterOverflow : DataOutputStream
- {
- public CounterOverflow(Stream output)
- : base(output)
- {
- base.written = int.MaxValue;
- }
- }
-
- [Test, LuceneNetSpecific]
- public void TestWriteUTF()
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(baos);
- dos.WriteUTF("Hello, World!"); // 15
- dos.Flush();
- if (baos.Length != dos.Length)
- fail("Miscounted bytes in DataOutputStream.");
- }
-
- [Test, LuceneNetSpecific]
- public void TestBoundsCheck()
- {
- byte[] data = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DummyFilterStream dfs = new DummyFilterStream(bos);
- bool caughtException = false;
-
- // -ve length
- try
- {
- dfs.Write(data, 0, -5);
- }
-#pragma warning disable 168
- catch (ArgumentOutOfRangeException ie)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- if (!caughtException)
- fail("Test failed");
- }
-
- // -ve offset
- caughtException = false;
- try
- {
- dfs.Write(data, -2, 5);
- }
-#pragma warning disable 168
- catch (ArgumentOutOfRangeException ie)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- if (!caughtException)
- fail("Test failed");
- }
-
- // off + len > data.length
- caughtException = false;
- try
- {
- dfs.Write(data, 6, 5);
- }
-#pragma warning disable 168
- catch (ArgumentException ie)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- if (!caughtException)
- fail("Test failed");
- }
-
- // null data
- caughtException = false;
- try
- {
- dfs.Write(null, 0, 5);
- }
-#pragma warning disable 168
- catch (ArgumentNullException re)
-#pragma warning restore 168
- {
- caughtException = true;
- }
- finally
- {
- if (!caughtException)
- fail("Test failed");
- }
- }
-
- private class DummyFilterStream : DataOutputStream
- {
-
- public DummyFilterStream(Stream o)
- : base(o)
- {
- }
-
- public override void Write(int val)
- {
- base.Write(val + 1);
- }
- }
-
- [Test, LuceneNetSpecific]
- public void TestWrite()
- {
- IDataOutput f = new F(new Sink());
- f.Write(new byte[] { 1, 2, 3 }, 0, 3);
- }
-
- private class F : DataOutputStream
- {
-
- public F(Stream o)
- : base(o)
- {
- }
-
- public override void Write(int b)
- {
- Debug.WriteLine("Ignoring write of " + b);
- }
-
- }
-
- private class Sink : MemoryStream
- {
-
- public override void WriteByte(byte b)
- {
- throw new Exception("DataOutputStream directly invoked"
- + " Write(byte) method of underlying"
- + " stream");
- }
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/Support/TestSafeTextWriterWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/TestSafeTextWriterWrapper.cs b/src/Lucene.Net.Tests/Support/TestSafeTextWriterWrapper.cs
deleted file mode 100644
index 28d7d86..0000000
--- a/src/Lucene.Net.Tests/Support/TestSafeTextWriterWrapper.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-using Lucene.Net.Util;
-using NUnit.Framework;
-using System;
-using System.IO;
-
-namespace Lucene.Net.Support
-{
- public class TestSafeTextWriterWrapper : LuceneTestCase
- {
- [Test]
- public void TestWrite()
- {
- SafeTextWriterWrapper safe;
- using (TextWriter wrapped = new StringWriter())
- {
- safe = new SafeTextWriterWrapper(wrapped);
-
- safe.Write('a');
- assertEquals("a", wrapped.ToString());
- }
-
- Assert.DoesNotThrow(() => safe.Write('a'));
- Assert.DoesNotThrow(() => safe.Write('a'));
- Assert.DoesNotThrow(() => safe.Write("a"));
- }
-
- [Test]
- public void TestWriteLine()
- {
- SafeTextWriterWrapper safe;
- using (TextWriter wrapped = new StringWriter())
- {
- safe = new SafeTextWriterWrapper(wrapped);
-
- safe.WriteLine('a');
- assertEquals("a" + Environment.NewLine, wrapped.ToString());
-
- safe.WriteLine("This is a test");
- assertEquals("a" + Environment.NewLine + "This is a test" + Environment.NewLine, wrapped.ToString());
- }
-
- Assert.DoesNotThrow(() => safe.WriteLine('a'));
- Assert.DoesNotThrow(() => safe.WriteLine("Testing"));
- Assert.DoesNotThrow(() => safe.WriteLine("Testing"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net.Tests/project.json
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/project.json b/src/Lucene.Net.Tests/project.json
index 7b32397..ccdeed7 100644
--- a/src/Lucene.Net.Tests/project.json
+++ b/src/Lucene.Net.Tests/project.json
@@ -48,7 +48,7 @@
"Index/unsupported.24.nocfs.zip",
"Index/unsupported.29.cfs.zip",
"Index/unsupported.29.nocfs.zip",
- "Support/ReadFully.txt"
+ "Support/IO/ReadFully.txt"
]
}
},
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs
index 6e9ad49..5ef6586 100644
--- a/src/Lucene.Net/Index/CheckIndex.cs
+++ b/src/Lucene.Net/Index/CheckIndex.cs
@@ -1,4 +1,5 @@
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.Collections.Generic;
using System.Diagnostics;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/SegmentInfos.cs b/src/Lucene.Net/Index/SegmentInfos.cs
index def455f..5ad2b31 100644
--- a/src/Lucene.Net/Index/SegmentInfos.cs
+++ b/src/Lucene.Net/Index/SegmentInfos.cs
@@ -1,4 +1,5 @@
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.Collections;
using System.Collections.Generic;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj
index ca7fffe..16e9d51 100644
--- a/src/Lucene.Net/Lucene.Net.csproj
+++ b/src/Lucene.Net/Lucene.Net.csproj
@@ -620,7 +620,7 @@
<Compile Include="Support\AttributeItem.cs" />
<Compile Include="Support\BitArrayExtensions.cs" />
<Compile Include="Support\BundleResourceManagerFactory.cs" />
- <Compile Include="Support\ByteArrayOutputStream.cs" />
+ <Compile Include="Support\IO\ByteArrayOutputStream.cs" />
<Compile Include="Support\C5.Support.cs" />
<Compile Include="Support\Character.cs" />
<Compile Include="Support\Arrays.cs" />
@@ -635,14 +635,14 @@
<Compile Include="Support\Codecs\ExcludePostingsFormatFromScanAttribute.cs" />
<Compile Include="Support\Codecs\IPostingsFormatFactory.cs" />
<Compile Include="Support\Codecs\PostingsFormatNameAttribute.cs" />
- <Compile Include="Support\Compatibility\BinaryReaderDataInput.cs" />
- <Compile Include="Support\Compatibility\BinaryWriterDataOutput.cs" />
+ <Compile Include="Support\IO\BinaryReaderDataInput.cs" />
+ <Compile Include="Support\IO\BinaryWriterDataOutput.cs" />
<Compile Include="Support\Collections.cs" />
<Compile Include="Support\ConcurrentHashMapWrapper.cs" />
<Compile Include="Support\ConcurrentHashSet.cs" />
<Compile Include="Support\CultureContext.cs" />
- <Compile Include="Support\DataInputStream.cs" />
- <Compile Include="Support\DataOutputStream.cs" />
+ <Compile Include="Support\IO\DataInputStream.cs" />
+ <Compile Include="Support\IO\DataOutputStream.cs" />
<Compile Include="Support\Codecs\DefaultCodecFactory.cs" />
<Compile Include="Support\Equatable.cs" />
<Compile Include="Support\EquatableSet.cs" />
@@ -653,8 +653,8 @@
<Compile Include="Support\ICallable.cs" />
<Compile Include="Support\ICharSequence.cs" />
<Compile Include="Support\ICompletionService.cs" />
- <Compile Include="Support\IDataInput.cs" />
- <Compile Include="Support\IDataOutput.cs" />
+ <Compile Include="Support\IO\IDataInput.cs" />
+ <Compile Include="Support\IO\IDataOutput.cs" />
<Compile Include="Support\IdentityComparer.cs" />
<Compile Include="Support\IdentityHashMap.cs" />
<Compile Include="Support\IdentityHashSet.cs" />
@@ -685,10 +685,10 @@
<Compile Include="Support\PriorityQueue.cs" />
<Compile Include="Support\ReaderWriterLockSlimExtensions.cs" />
<Compile Include="Support\ReentrantLock.cs" />
- <Compile Include="Support\SafeTextWriterWrapper.cs" />
+ <Compile Include="Support\IO\SafeTextWriterWrapper.cs" />
<Compile Include="Support\SetExtensions.cs" />
<Compile Include="Support\SignedZeroComparer.cs" />
- <Compile Include="Support\StreamUtils.cs" />
+ <Compile Include="Support\IO\StreamUtils.cs" />
<Compile Include="Support\StringBuilderExtensions.cs" />
<Compile Include="Support\StringCharSequenceWrapper.cs" />
<Compile Include="Support\StringExtensions.cs" />
@@ -707,17 +707,17 @@
<Compile Include="Support\Compatibility\ThreadLocal.cs" />
<Compile Include="Support\Compatibility\WrappedHashSet.cs" />
<Compile Include="Support\CRC32.cs" />
- <Compile Include="Support\Deflater.cs" />
+ <Compile Include="Support\IO\Compression\Deflater.cs" />
<Compile Include="Support\EquatableList.cs" />
- <Compile Include="Support\FileSupport.cs" />
+ <Compile Include="Support\IO\FileSupport.cs" />
<Compile Include="Support\GeneralKeyedCollection.cs" />
<Compile Include="Support\HashMap.cs" />
<Compile Include="Support\IChecksum.cs" />
- <Compile Include="Support\Inflater.cs" />
+ <Compile Include="Support\IO\Compression\Inflater.cs" />
<Compile Include="Support\IThreadRunnable.cs" />
<Compile Include="Support\Number.cs" />
<Compile Include="Support\OS.cs" />
- <Compile Include="Support\SharpZipLib.cs" />
+ <Compile Include="Support\IO\Compression\SharpZipLib.cs" />
<Compile Include="Support\ThreadClass.cs" />
<Compile Include="Support\ThreadLock.cs" />
<Compile Include="Support\Util\ExcludeServiceAttribute.cs" />
@@ -912,5 +912,6 @@
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Search/FieldCacheImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs
index 2c90960..9242770 100644
--- a/src/Lucene.Net/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net/Search/FieldCacheImpl.cs
@@ -1,5 +1,6 @@
using Lucene.Net.Index;
using Lucene.Net.Support;
+using Lucene.Net.Support.IO;
using System;
using System.Collections.Generic;
using System.Diagnostics;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Support/ByteArrayOutputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/ByteArrayOutputStream.cs b/src/Lucene.Net/Support/ByteArrayOutputStream.cs
deleted file mode 100644
index fd70ba7..0000000
--- a/src/Lucene.Net/Support/ByteArrayOutputStream.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-\ufeffusing System.IO;
-using System.Text;
-
-namespace Lucene.Net.Support
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- // Used to wrap Java's ByteArrayOutputStream's ToString() method, as MemoryStream uses default impl
- public class ByteArrayOutputStream : MemoryStream
- {
- public ByteArrayOutputStream()
- {
- }
-
- public ByteArrayOutputStream(int size)
- : base(size)
- {
- }
-
- public override string ToString()
- {
- return Encoding.UTF8.GetString(this.ToArray());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Support/Compatibility/BinaryReaderDataInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/Compatibility/BinaryReaderDataInput.cs b/src/Lucene.Net/Support/Compatibility/BinaryReaderDataInput.cs
deleted file mode 100644
index 414c294..0000000
--- a/src/Lucene.Net/Support/Compatibility/BinaryReaderDataInput.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-\ufeffusing Lucene.Net.Store;
-using System;
-using System.IO;
-
-namespace Lucene.Net.Support.Compatibility
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- public class BinaryReaderDataInput : DataInput, IDisposable
- {
- private readonly BinaryReader br;
- public BinaryReaderDataInput(BinaryReader br)
- {
- this.br = br;
- }
-
- public override byte ReadByte()
- {
- return br.ReadByte();
- }
-
- public override void ReadBytes(byte[] b, int offset, int len)
- {
- byte[] temp = br.ReadBytes(len);
- for (int i = offset; i < (offset + len) && i < temp.Length; i++)
- {
- b[i] = temp[i];
- }
- }
-
- public void Dispose()
- {
- br.Dispose();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37901853/src/Lucene.Net/Support/Compatibility/BinaryWriterDataOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/Compatibility/BinaryWriterDataOutput.cs b/src/Lucene.Net/Support/Compatibility/BinaryWriterDataOutput.cs
deleted file mode 100644
index f895e94..0000000
--- a/src/Lucene.Net/Support/Compatibility/BinaryWriterDataOutput.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-\ufeffusing System;
-using System.IO;
-using Lucene.Net.Store;
-
-namespace Lucene.Net.Support.Compatibility
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- public class BinaryWriterDataOutput : DataOutput, IDisposable
- {
- private readonly BinaryWriter bw;
-
- public BinaryWriterDataOutput(BinaryWriter bw)
- {
- this.bw = bw;
- }
-
- public override void WriteByte(byte b)
- {
- bw.Write(b);
- }
-
- public override void WriteBytes(byte[] b, int offset, int length)
- {
- bw.Write(b, offset, length);
- }
-
- public void Dispose()
- {
- bw.Dispose();
- }
- }
-}