Files
EWF/json/json_file_reader.e
2008-05-24 14:23:27 +00:00

36 lines
881 B
Plaintext

indexing
description: "Objects that ..."
author: ""
date: "$Date$"
revision: "$Revision$"
class
JSON_FILE_READER
feature -- Access
read_json_from(a_path:STRING):STRING is
local
l_file: PLAIN_TEXT_FILE
template_content:STRING
do
create l_file.make (a_path)
-- We perform several checks until we make a real attempt to open the file.
if not l_file.exists then
print ("error: '" + a_path + "' does not exist%N")
else
if not l_file.is_readable then
print ("error: '" + a_path + "' is not readable.%N")
else
l_file.open_read
create template_content.make_empty
l_file.read_stream (l_file.count)
template_content.append (l_file.last_string.twin)
Result := template_content
l_file.close
end
end
end
end