浏览代码

Added Skip() to stream.

Mark Sibly 9 年之前
父节点
当前提交
f9bfb18c5c
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      modules/std/stream/stream.monkey2

+ 14 - 0
modules/std/stream/stream.monkey2

@@ -62,6 +62,20 @@ Class Stream
 	#end
 	Method Write:Int( mem:Void Ptr,count:Int ) Abstract
 	
+	#rem monkeydoc Reads data from the filestream and throws it away.
+
+	@param count The number of bytes to skip.
+	
+	@return The number of bytes actually skipped.
+	
+	#end
+	Method Skip:Int( count:Int )
+		Local tmp:=libc.malloc( count )
+		Local n:=Read( tmp,count )
+		libc.free( tmp )
+		Return n
+	End
+	
 	#rem monkeydoc The byte order of the stream.
 	#end
 	Property ByteOrder:ByteOrder()