Lucene.Net.Demo.Html.HTMLParser.GetSummary C# (CSharp) Method

GetSummary() public method

public GetSummary ( ) : System.String
return System.String
		public virtual System.String GetSummary()
		{
			if (pipeIn == null)
				GetReader(); // spawn parsing thread
			while (true)
			{
				lock (this)
				{
					if (summary.Length >= SUMMARY_LENGTH || pipeInStream.Full())
						break;
					System.Threading.Monitor.Wait(this, TimeSpan.FromMilliseconds(10));
				}
			}
			if (summary.Length > SUMMARY_LENGTH)
				summary.Length = SUMMARY_LENGTH;
			
			System.String sum = summary.ToString().Trim();
			System.String tit = GetTitle();
			if (sum.StartsWith(tit) || sum.Equals(""))
				return tit;
			else
				return sum;
		}
		

Usage Example

Example #1
0
 public static void  Parse(System.IO.FileInfo file)
 {
     HTMLParser parser = new HTMLParser(file);
     System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle()));
     System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary()));
     System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding);
     for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine())
         System.Console.Out.WriteLine(l);
 }
All Usage Examples Of Lucene.Net.Demo.Html.HTMLParser::GetSummary