/// <summary> /// This disposes the object. /// It cannot be used again after this call. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { // Dispose managed resources. try { if (writeStream != null) { writeStream.Dispose(); } } catch (Exception e) { Logger.Error("Failed to dispose of stream", e); } try { if (readStream != null) { readStream.Dispose(); } } catch (Exception e) { Logger.Error("Failed to dispose of stream", e); } } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } disposed = true; }
public IReadStream <T> Create(IReadStream <string> stringStream) { try { IAdapter <IReadOnlyDictionary <string, string>, T> objectAdapter = null; return(new HeaderBasedAdapterStream <string, T>(stringStream, XsvAdapterFactory.CreateXsvToObjectFactory(split, objectAdapter))); } catch (Exception) { stringStream.Dispose(); throw; } }
/// <summary> /// This disposes the object. /// It cannot be used again after this call. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { // Dispose managed resources. if (stream != null) { stream.Dispose(); } } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } disposed = true; }