Commit Graph
73 Commits
Author SHA1 Message Date
Marek Safar 9bc33d4aae [corlib] Use shared version of utf8 encoding in stream reader 2014-02-05 16:56:02 +01:00
Marek Safar d3b817cbb8 [corlib] Initialize null stream reader 2014-02-04 13:14:33 +01:00
Marek Safar 8e318f410b Break direct TPL dependency from stream classes 2013-02-16 13:15:52 +01:00
Marek Safar 185743cacd Rewrite of async StreamReader/StreamWritter operations to not fail on subsequent async call. Fixes #9761 2013-02-01 18:29:54 +01:00
Marek Safar 7b51bb0cb1 Implement stream async methods 2011-09-28 08:09:33 +01:00
Marek Safar 11db01b5a1 Add few new 4.5 overloads 2011-09-19 19:34:27 +01:00
Rodrigo Kumpera d72794cced Reorder fields to improve object layout since the runtime can't do it for corlib types. 2011-05-23 01:13:09 -03:00
Gonzalo Paniagua Javier ea76aa9964 2010-03-17 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: if the detected encoding is different from the
	provided to the constructor, adjust the decoded buffer size if
	needed. Fixes bug #589236.


svn path=/trunk/mcs/; revision=153799
2010-03-18 02:41:08 +00:00
Carlos Alberto Cortez 542171144b 2010-01-23 Carlos Alberto Cortez <[email protected]>
* StreamReader.cs: When detecting the encoding we usually check the
	four first bytes looking for either UTF32 or UTF8 BOM, since they share
	the first two bytes, but if we happen to have less than 4 bytes at
	detection time, just check for Unicode and use it as the current
	encoding - this is exactly what .Net does, and it is specially visible
	with NetworkStream.
	Fixes #534137.


svn path=/trunk/mcs/; revision=150090
2010-01-24 04:07:35 +00:00
Marek Safar 6bec77af06 2009-11-24 Marek Safar <[email protected]>
* StreamReader.cs, FileStream.cs: Use recycle buffer to avoid
	repeated underlying buffer initialization (saves hefty 10MB
	during corlib compilation).
	
	* Path.cs (InsecureGetFullPath): Avoid CanonicalizePath in common
	path.


svn path=/trunk/mcs/; revision=146841
2009-11-24 16:30:55 +00:00
Miguel de Icaza 0204abe803 Drop more obsolete defines
svn path=/trunk/mcs/; revision=144304
2009-10-17 01:35:27 +00:00
Sebastien Pouliot 4cfb97dff5 fix smcs with utf32 encoded files
svn path=/trunk/mcs/; revision=142544
2009-09-24 01:19:05 +00:00
Sebastien Pouliot 5574bdb8b5 2009-09-22 Sebastien Pouliot <[email protected]>
* StreamReader.cs: Don't use UTF32 under NET_2_1


svn path=/trunk/mcs/; revision=142392
2009-09-22 13:13:56 +00:00
Miguel de Icaza c811d8c9d8 Add comment after much debate
svn path=/trunk/mcs/; revision=132672
2009-04-25 19:34:34 +00:00
Miguel de Icaza 1b774ddf6d 2009-04-25 Miguel de Icaza <[email protected]>
* TermInfoDriver.cs: Use the new StreamReader.DataAvailable to
	load all the data that was added into the `stdin' stream when we
	did the `Read'.

2009-04-25  Miguel de Icaza  <[email protected]>

	* StreamReader.cs (DataAvailable): New internal function to work
	around the fact that StreamReaders are now blocking on Peek(), and
	that our own Console.TermInfoDriver used Peek() as a way of
	probing if there was data on a stream before to avoid blocking. o


svn path=/trunk/mcs/; revision=132670
2009-04-25 19:32:34 +00:00
Miguel de Icaza 8b1742d19b Reapply
svn path=/trunk/mcs/; revision=132666
2009-04-25 18:59:23 +00:00
Miguel de Icaza c2545dcc09 Revert 132601, 132602 as it made the csharp console stop working
svn path=/trunk/mcs/; revision=132638
2009-04-24 23:43:12 +00:00
Gonzalo Paniagua Javier ff67b08189 2009-04-24 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: if Peek() needs to block, do it.
	Fixes bug #496905.


svn path=/trunk/mcs/; revision=132601
2009-04-24 16:46:19 +00:00
Gonzalo Paniagua Javier ebb8a2fb03 2009-02-06 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: when a LF ends a decoded buffer and is not followed
	by a CR in the next decoded buffer, we didn't flush the string.
	Fixes bug #445326.


svn path=/trunk/mcs/; revision=126131
2009-02-06 23:01:29 +00:00
Andreas N b7ebfaf624 2008-07-03 Andreas Nahr <[email protected]>
* TextWriter.cs:
	* StreamWriter.cs:
	* StreamReader.cs:
	* Stream.cs:
	* MemoryStream.cs:
	* File.cs:
	* DriveNotFoundException.cs:
	* Directory.cs: Fix parameter names

svn path=/trunk/mcs/; revision=107182
2008-07-03 20:00:51 +00:00
Atsushi Eno d26a2ab039 2007-11-02 Atsushi Enomoto <[email protected]>
* StreamReader.cs : Encoding.GetMaxCharCount() does not always return
	  the maximum max char count for Decoder.GetChars() since it might
	  contain pending buffer by flush. Fixed bug #338370.


svn path=/trunk/mcs/; revision=88712
2007-11-02 09:37:12 +00:00
Dick Porter 5b79519900 2007-04-30 Dick Porter <[email protected]>
* Directory.cs: 
	* FileShare.cs: 
	* DirectoryNotFoundException.cs: 
	* SeekOrigin.cs: 
	* FileAttributes.cs: 
	* IOException.cs: 
	* MemoryStream.cs: 
	* FileMode.cs: 
	* BinaryWriter.cs: 
	* TextWriter.cs: 
	* File.cs: 
	* BinaryReader.cs: 
	* TextReader.cs: 
	* UnmanagedMemoryStream.cs: 
	* StringWriter.cs: 
	* FileAccess.cs: 
	* FileLoadException.cs: 
	* BufferedStream.cs: 
	* Stream.cs: 
	* FileInfo.cs: 
	* FileStream.cs:
	* StringReader.cs: 
	* StreamWriter.cs: 
	* EndOfStreamException.cs: 
	* DriveInfo.cs: 
	* StreamReader.cs: 
	* PathTooLongException.cs: 
	* DriveType.cs: 
	* FileNotFoundException.cs: 2.0 profile updates



svn path=/trunk/mcs/; revision=76495
2007-04-30 14:05:12 +00:00
Miguel de Icaza c6e197166f Add support for detecting UTF32 and UTF-32 bigendian
patch from  Peter Dettman ([email protected])


svn path=/trunk/mcs/; revision=73779
2007-03-06 04:26:50 +00:00
Gert Driesen c6856bc091 * StreamReader.cs: Removed checks for non-existing directory or file,
since these checks are also performed in FileStream.

Note: ChangeLog went in with separate commit.

svn path=/trunk/mcs/; revision=72060
2007-01-31 22:33:10 +00:00
Gonzalo Paniagua Javier 167ec9bddd 2007-01-24 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: fix for bug #75526. We return earlier from Read () if
	the underlying stream might block or end on the next read.


svn path=/trunk/mcs/; revision=71650
2007-01-25 06:12:54 +00:00
Miguel de Icaza 93e6ec21f7 revert, this was a mistake
svn path=/trunk/mcs/; revision=71617
2007-01-24 18:37:03 +00:00
Miguel de Icaza ec090a9505 2007-01-23 Miguel de Icaza <[email protected]>
* StreamReader.cs (Read): Fix this overload, we were just lucky
	that it worked in the past.   Must trigger a load from the buffer
	if we reached its end.

svn path=/trunk/mcs/; revision=71573
2007-01-24 00:45:35 +00:00
Gonzalo Paniagua Javier 2dd8186026 2006-08-30 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: avoid ArgumentOutRangeException when the underlying
	stream returns -1 on Read.


svn path=/trunk/mcs/; revision=64568
2006-08-30 18:27:44 +00:00
Atsushi Eno ad24284d1a 2006-04-28 Atsushi Enomoto <[email protected]>
* StreamReader.cs : implemented EndOfStream property.
	* File.cs : implemented AppendAllText(), WriteAllLines(),
	  WriteAllBytes() and ReadAllLines(). Bug #77813 fixed.


svn path=/trunk/mcs/; revision=60046
2006-04-28 17:14:16 +00:00
Gonzalo Paniagua Javier d792f22837 2006-01-20 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: (ReadToEnd) if Read returns -1 or 0, we're done.


svn path=/trunk/mcs/; revision=55842
2006-01-20 16:57:23 +00:00
Joshua Tauberer f040522e22 StreamReader.cs: Avoid two totally unnecessary string creations. (totally pedantic)
svn path=/trunk/mcs/; revision=55698
2006-01-17 21:38:03 +00:00
Gonzalo Paniagua Javier 035c97a148 2005-10-20 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: made ReadLine() less memory-hungry. Fixes bug #76399.


svn path=/trunk/mcs/; revision=52004
2005-10-20 20:28:48 +00:00
Raja R Harinath cdb301b708 Fix #75679.
* StreamReader.cs (DiscardBufferedData): Reset the decoder too.

(r=eno)

svn path=/trunk/mcs/; revision=48719
2005-08-23 12:17:17 +00:00
Lluis Sanchez 92673ba006 * StreamReader.cs: In DiscardBufferedData(), reset the mayBlock flag.
svn path=/trunk/mcs/; revision=30288
2004-06-24 09:34:12 +00:00
Atsushi Eno 5412643255 2004-06-21 Atsushi Enomoto <[email protected]>
* FileStream.cs : Check buffer size before creating file.
	* StreamReader.cs : Check encoding!=null before creating file.
	* File.cs,
	  MonoIO.cs : Convert DateTime to FileTime after checking
	  file IO sharing violation (it just fixes the type of exception).

svn path=/trunk/mcs/; revision=30033
2004-06-21 13:30:46 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Duncan Mak 560c5a0645 (StreamReader):
(Initialize): Add a check that buffer_size must not be less than
or equal to zero.

svn path=/trunk/mcs/; revision=29056
2004-06-08 19:08:03 +00:00
Sebastien Pouliot 03b1d4987c 2004-05-24 Sebastien Pouliot <[email protected]>
* StreamReader.cs: Add checks for null encoding. Fixed possible integer
	overflow and ArgumentNullException in Read.

svn path=/trunk/mcs/; revision=28000
2004-05-24 20:15:47 +00:00
Miguel de Icaza 7c95f0650a A couple more TODOs
svn path=/trunk/mcs/; revision=20012
2003-11-14 22:32:04 +00:00
Gonzalo Paniagua Javier 6e323452f6 2003-11-14 Gonzalo Paniagua Javier <[email protected]>
* FileStream.cs: use the argument name when throwing exception.

	* StreamReader.cs:
	* StringReader.cs:
	* TextReader.cs: added [In] attribute for the array in Read.

svn path=/trunk/mcs/; revision=19987
2003-11-14 04:06:38 +00:00
Miguel de Icaza a61252bd95 2003-10-28 Miguel de Icaza <[email protected]>
* StreamReader.cs: Add checks for disposed stream from bug report
	#48696 (Patrik Reali)

	* TextReader.cs (Read): Return the total number of bytes read,
	patch from Patrik Realli.

svn path=/trunk/mcs/; revision=19435
2003-10-28 17:55:05 +00:00
Martin Baulig a93aa128ac 2003-08-05 Martin Baulig <[email protected]>
* StreamReader.cs (DiscardBufferedData): Do the same like on the
	ms runtime: just discard the buffered data, but don't modify the
	BaseStream.Position.

svn path=/trunk/mcs/; revision=17081
2003-08-05 23:44:24 +00:00
Martin Baulig f8ff4a9743 2003-08-05 Martin Baulig <[email protected]>
* StreamReader.cs (DiscardBufferedData): This is only allowed on
	seekable streams.

svn path=/trunk/mcs/; revision=17076
2003-08-05 20:19:38 +00:00
Martin Baulig 2ac3dab1ba 2003-08-04 Martin Baulig <[email protected]>
* StreamReader.cs (DiscardBufferedData): Implemented.

svn path=/trunk/mcs/; revision=17051
2003-08-04 13:32:10 +00:00
Miguel de Icaza 13c56abe99 2003-07-24 Miguel de Icaza <[email protected]>
* Type.cs: Added generics stubs.

2003-07-24  Miguel de Icaza  <[email protected]>

	* ArrayList.cs: Removed MonoTODO.

2003-07-24  Miguel de Icaza  <[email protected]>

	* TypeDelegator.cs: Added generics stubs.

2003-07-24  Miguel de Icaza  <[email protected]>

	* TypeBuilder.cs: Added generics stubs.

	* EnumBuilder.cs: Added generics  stubs, changed bracing style for
	routines.

svn path=/trunk/mcs/; revision=16621
2003-07-24 20:26:37 +00:00
Duncan Mak a2b66b251f * DateTimeFormatInfo.cs: theInvariantDateTimeFormatInfo should not
be public.

* StreamReader.cs (Initialize): This method is not exposed in the
API, mark as internal.

* SignatureHelper.cs: This class does not have the
SerializableAttribute.

* WaitHandle.cs (CheckDisposed): This method is not in the public
API, mark it as 'internal'.

* Environment.cs (SpecialFolder): Added 'Desktop' and 'MyComputer'
as values for NET_1_1.
(GetFolderPath): Return the empty string ("") for values of
SpecialFolder that have no corresponding equivalents in
Linux. Return "$HOME/Desktop" for SpecialFolder.DesktopDirectory
and "$HOME" for SpecialFolder.Personal.

* IntPtr.cs (GetObjectData): Mark it as an interface
implementation, instead of a public method.

* Guid.cs (NewGuid): Remove MonoTODOAttribute.

* TypeLoadException.cs (GetObjectData):
Create stubs for the fields that are being serialized.

* UIntPtr.cs: Removed erroneous CLSCompliantAttributes.

svn path=/trunk/mcs/; revision=16594
2003-07-24 03:28:43 +00:00
Gonzalo Paniagua Javier b76faa4b6e 2003-05-04 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs:
	(.ctor): fixed parameters passed to FileNotFoundException.

svn path=/trunk/mcs/; revision=14241
2003-05-04 02:43:21 +00:00
Gonzalo Paniagua Javier 0f62bbab30 2003-03-07 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: fixed bug #39280.

svn path=/trunk/mcs/; revision=12321
2003-03-07 18:47:04 +00:00
Gonzalo Paniagua Javier 66f65c4774 2002-11-07 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: Changed all Encoding.UTF8 to Encoding.UTF8Unmarked.

svn path=/trunk/mcs/; revision=8861
2002-11-07 00:24:24 +00:00
Gonzalo Paniagua Javier 71752a091e 2002-10-21 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: ReadLine now treats a \r not followed by a \n as a
	\n (this is what MS does).

svn path=/trunk/mcs/; revision=8448
2002-10-21 16:40:28 +00:00