public function setFilePointer($pointer)
	{
		if(!is_resource($pointer))
			throw new InvalidArgumentException("Invalid type - not a file resource");
		
		$this->pointer = $pointer;
		
		# and now to set everything up...
		$metadata = stream_get_meta_data($this->pointer);
		
		# can this stream be read from?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_readable = true;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_readable = $super;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# can this stream be written to?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_writable = $super;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_writable = true;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# does this stream support seek functionality?
		if(isset($metadata["seekable"]))
			$this->is_seekable = (boolean) $metadata["seekable"];
		
		return null;
	}
public function setFilePointer($pointer)
	{
		if(!is_resource($pointer))
			throw new InvalidArgumentException("Invalid type - not a file resource");
		
		$this->pointer = $pointer;
		
		# and now to set everything up...
		$metadata = stream_get_meta_data($this->pointer);
		
		# can this stream be read from?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_readable = true;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_readable = $super;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# can this stream be written to?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_writable = $super;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_writable = true;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# does this stream support seek functionality?
		if(isset($metadata["seekable"]))
			$this->is_seekable = (boolean) $metadata["seekable"];
		
		return null;
	}
public function setFilePointer ( $ pointer ) { if ( ! is_resource ( $ pointer ) ) throw new InvalidArgumentException ( "Invalid type - not a file resource" ) ; $ this -> pointer = $ pointer ; # and now to set everything up... $ metadata = stream_get_meta_data ( $ this -> pointer ) ; # can this stream be read from? if ( isset ( $ metadata [ "mode" ] ) ) { $ mode = rtrim ( $ metadata [ "mode" ] , "bt" ) ; $ super = ( boolean ) preg_match ( "/\+$/" , $ mode ) ; $ mode = rtrim ( $ mode , "+" ) ; switch ( $ mode ) { case "r" : $ this -> is_readable = true ; break ; case "w" : case "a" : case "x" : case "c" : $ this -> is_readable = $ super ; break ; default : throw new LogicException ( "Invalid file access type: '" . $ metadata [ "mode" ] . "'" ) ; break ; } } # can this stream be written to? if ( isset ( $ metadata [ "mode" ] ) ) { $ mode = rtrim ( $ metadata [ "mode" ] , "bt" ) ; $ super = ( boolean ) preg_match ( "/\+$/" , $ mode ) ; $ mode = rtrim ( $ mode , "+" ) ; switch ( $ mode ) { case "r" : $ this -> is_writable = $ super ; break ; case "w" : case "a" : case "x" : case "c" : $ this -> is_writable = true ; break ; default : throw new LogicException ( "Invalid file access type: '" . $ metadata [ "mode" ] . "'" ) ; break ; } } # does this stream support seek functionality? if ( isset ( $ metadata [ "seekable" ] ) ) $ this -> is_seekable = ( boolean ) $ metadata [ "seekable" ] ; return null ; }
Set the file pointer
Set the file pointer