// // Summary: // Skip response data when requested by a Range header. Skip over and discard bytesToSkip // bytes of response data. - If data is available immediately set bytesSkipped to // the number of of bytes skipped and return true. - To read the data at a later // time set bytesSkipped to 0, return true and execute callback when the data is // available. - To indicate failure set bytesSkipped to < 0 (e.g. -2 for ERR_FAILED) // and return false. This method will be called in sequence but not from a dedicated // thread. // // Parameters: // bytesToSkip: // number of bytes to be skipped // // bytesSkipped: // If data is available immediately set bytesSkipped to the number of of bytes skipped // and return true. To read the data at a later time set bytesSkipped to 0, return // true and execute callback when the data is available. // // callback: // To read the data at a later time set bytesSkipped to 0, return true and execute // callback when the data is available. // // Returns: // See summary public bool Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { // To indicate failure set bytesSkipped to < 0 (e.g. -2 for ERR_FAILED) // and return false. bytesSkipped = -2; return(false); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement). callback.Dispose(); //No Stream or Stream cannot seek then we indicate failure if (stream == null || !stream.CanSeek) { //Indicate failure bytesSkipped = -2; return(false); } if (stream.Position == (stream.Length - 1)) { bytesSkipped = 0; return(true); } var oldPosition = stream.Position; var position = stream.Seek(bytesToSkip, SeekOrigin.Current); bytesSkipped = position - oldPosition; return(true); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //No Stream or Stream cannot seek then we indicate failure if (stream == null || !stream.CanSeek) { //Indicate failure bytesSkipped = -2; return(false); } if (stream.Position == (stream.Length - 1)) { bytesSkipped = 0; return(true); } var oldPosition = stream.Position; var position = stream.Seek(bytesToSkip, SeekOrigin.Current); bytesSkipped = position - oldPosition; return(true); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { if (_stream == null || !_stream.CanSeek) { bytesSkipped = -2; return(false); } bytesSkipped = bytesToSkip; _stream.Seek(bytesToSkip, SeekOrigin.Current); return(false); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //No Stream or Stream cannot seek then we indicate failure if (Stream == null || !Stream.CanSeek) { //Indicate failure bytesSkipped = -2; return(false); } bytesSkipped = bytesToSkip; Stream.Seek(bytesToSkip, SeekOrigin.Current); return(false); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //No Stream or Stream cannot seek then we indicate failure if (Stream == null || !Stream.CanSeek) { //Indicate failure bytesSkipped = -2; return(false); } bytesSkipped = bytesToSkip; Stream.Seek(bytesToSkip, SeekOrigin.Current); //If data is available immediately set bytesSkipped to the number of of bytes skipped and return true. return(true); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement). callback.Dispose(); //No Stream or Stream cannot seek then we indicate failure if (Stream == null || !Stream.CanSeek) { //Indicate failure bytesSkipped = -2; return(false); } bytesSkipped = bytesToSkip; Stream.Seek(bytesToSkip, SeekOrigin.Current); //If data is available immediately set bytesSkipped to the number of of bytes skipped and return true. return(true); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { bytesSkipped = -1; return(false); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { throw new NotImplementedException(); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { //Should never be called throw new NotImplementedException("This method should never be called"); }
public bool Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { throw new System.NotImplementedException(); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { return(ResourceHandler.Skip(bytesToSkip, out bytesSkipped, callback)); }
public bool Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { bytesSkipped = 0; return(true); }
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback) { bytesSkipped = -2; // ERR_FAILED callback.Dispose(); return(false); }