XpressEngine Core
1.11.2
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
classes
file
FileObject.class.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
9
class
FileObject
extends
BaseObject
10
{
11
16
var
$fp
= NULL;
17
22
var
$path
= NULL;
23
28
var
$mode
=
"r"
;
29
37
function
__construct
(
$path
,
$mode
)
38
{
39
if
(
$path
!= NULL)
40
{
41
$this->Open(
$path
,
$mode
);
42
}
43
}
44
51
function
append
($file_name)
52
{
53
$target =
new
FileObject
($file_name,
"r"
);
54
while
(!$target->feof())
55
{
56
$readstr = $target->read();
57
$this->
write
($readstr);
58
}
59
$target->close();
60
}
61
67
function
feof
()
68
{
69
return
feof
($this->fp);
70
}
71
78
function
read
($size = 1024)
79
{
80
return
fread($this->fp, $size);
81
}
82
89
function
write
($str)
90
{
91
$len = strlen($str);
92
if
(!$str || $len <= 0)
93
{
94
return
FALSE;
95
}
96
if
(!$this->fp)
97
{
98
return
FALSE;
99
}
100
$written = fwrite($this->fp, $str);
101
return
$written;
102
}
103
113
function
open
(
$path
,
$mode
)
114
{
115
if
($this->fp != NULL)
116
{
117
$this->
close
();
118
}
119
$this->fp = fopen(
$path
,
$mode
);
120
if
(!is_resource($this->fp))
121
{
122
$this->fp = NULL;
123
return
FALSE;
124
}
125
$this->path =
$path
;
126
return
TRUE;
127
}
128
134
function
getPath
()
135
{
136
if
($this->fp != NULL)
137
{
138
return
$this->path
;
139
}
140
else
141
{
142
return
NULL;
143
}
144
}
145
151
function
close
()
152
{
153
if
($this->fp != NULL)
154
{
155
fclose($this->fp);
156
$this->fp = NULL;
157
}
158
}
159
160
}
161
/* End of file FileObject.class.php */
162
/* Location: ./classes/file/FileObject.class.php */
FileObject
Definition:
FileObject.class.php:9
FileObject\__construct
__construct($path, $mode)
Definition:
FileObject.class.php:37
FileObject\$path
$path
Definition:
FileObject.class.php:22
BaseObject
Definition:
BaseObject.class.php:9
FileObject\$mode
$mode
Definition:
FileObject.class.php:28
FileObject\open
open($path, $mode)
Definition:
FileObject.class.php:113
FileObject\write
write($str)
Definition:
FileObject.class.php:89
FileObject\getPath
getPath()
Definition:
FileObject.class.php:134
FileObject\feof
feof()
Definition:
FileObject.class.php:67
FileObject\close
close()
Definition:
FileObject.class.php:151
FileObject\append
append($file_name)
Definition:
FileObject.class.php:51
FileObject\read
read($size=1024)
Definition:
FileObject.class.php:78
FileObject\$fp
$fp
Definition:
FileObject.class.php:16
Generated on Tue Dec 18 2018 17:04:25 for XpressEngine Core by
1.8.5