fixed net-1.0 build error

fixed SPRNET-1201
This commit is contained in:
eeichinger
2009-06-27 03:38:41 +00:00
parent 60ecf0e05d
commit 145e2ae54b
2 changed files with 16 additions and 22 deletions

View File

@@ -116,12 +116,11 @@ namespace Spring.Context.Support
protected override void RefreshObjectFactory()
{
// Shut down previous object factory, if any.
IConfigurableListableObjectFactory oldObjectFactory = null;
oldObjectFactory = Interlocked.Exchange(ref _objectFactory, null);
IConfigurableListableObjectFactory oldObjectFactory = _objectFactory;
_objectFactory = null;
if (oldObjectFactory != null)
{
// _objectFactory = null;
oldObjectFactory.Dispose();
}

View File

@@ -3,16 +3,16 @@ using System.IO;
namespace Spring.Util
{
/// <summary>
/// Utility methods for IO handling
/// </summary>
/// <summary>
/// Utility methods for IO handling
/// </summary>
internal sealed class IOUtils
{
private IOUtils()
{
throw new InvalidOperationException("instantiation not supported");
}
/// <summary>
/// Copies one stream into another.
/// (Don't forget to call <see cref="Stream.Flush"/> on the destination stream!)
@@ -20,36 +20,31 @@ namespace Spring.Util
/// <remarks>
/// Does not close the input stream!
/// </remarks>
public static void CopyStream( Stream src, Stream dest )
public static void CopyStream(Stream src, Stream dest)
{
int bufferSize = 2048;
byte[] buffer = new byte[bufferSize];
int bytesRead = src.Read(buffer, 0, bufferSize);
while( bytesRead == bufferSize )
int bytesRead = 0;
while ((bytesRead = src.Read(buffer, 0, bufferSize)) > 0)
{
dest.Write( buffer, 0, bytesRead );
bytesRead = src.Read( buffer, 0, bufferSize );
dest.Write(buffer, 0, bytesRead);
}
if (bytesRead > 0)
{
dest.Write( buffer, 0, bytesRead );
}
}
/// <summary>
/// Reads a stream into a byte array.
/// </summary>
/// <remarks>
/// Does not close the input stream!
/// </remarks>
public static byte[] ToByteArray( Stream src )
public static byte[] ToByteArray(Stream src)
{
MemoryStream stm = new MemoryStream();
CopyStream( src, stm );
stm.Flush();
CopyStream(src, stm);
stm.Close();
return stm.ToArray();
}
}
}
}