-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileReader.cls
More file actions
43 lines (34 loc) · 1.12 KB
/
FileReader.cls
File metadata and controls
43 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "FileReader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'@Exposed
'@Folder("JSON.DataReaders")
Option Explicit
Implements IReader
Private Const ModuleName As String = "FileReader"
Private Type TData
Path As String
End Type
Private This As TData
Friend Sub Create(ByVal Path As String)
Const FunctionName As String = "Create"
Dim ErrorLogger As ErrorLogger
Set ErrorLogger = Factory.CreateErrorLogger(ModuleName, FunctionName)
This.Path = Path
End Sub
Private Function IReader_Execute() As String
Const FunctionName As String = "Create"
Dim ErrorLogger As ErrorLogger
Set ErrorLogger = Factory.CreateErrorLogger(ModuleName, FunctionName)
Dim Fso As Scripting.FileSystemObject
Set Fso = CreateObject("Scripting.fileSystemObject")
Dim IStream As Scripting.TextStream
Set IStream = Fso.OpenTextFile(This.Path, ForReading)
IReader_Execute = IStream.ReadAll
End Function