Stash Software API  2.0.0
Public Member Functions | List of all members
sFileSystem.jsonFileLib.JSONFile Class Reference

[ CLASS ] - Class to operate on JSON files. More...

Inheritance diagram for sFileSystem.jsonFileLib.JSONFile:
sFileSystem.fileLib.File sStashApp.stashAppLib.StashAppFile

Public Member Functions

def __init__ (self, absFile=None)
 Constructor. More...
 
def asStr (self)
 Get string representation. More...
 
def setFile (self, absFile)
 Set JSON file. More...
 
def write (self, indent=None)
 Write the content into the file. More...
 
def read (self)
 Read the content of the file and store it in content member. More...
 
Properties
def setContent (self, content)
 Set JSON content. More...
 
- Public Member Functions inherited from sFileSystem.fileLib.File
def __init__ (self, absFile=None)
 Constructor. More...
 
def __str__ (self)
 String representation. More...
 
def asStr (self)
 Get string representation. More...
 
def asDict (self)
 Get file information as dict instance. More...
 
def setFile (self, absFile)
 Set file. More...
 
def update (self)
 Update information of the file in case it has been altered. More...
 
def exists (self)
 Check whether the file exists. More...
 
def rename (self, newName)
 Rename the file. More...
 
def copy (self, destinationFile, overwrite=False)
 Copy the file. More...
 
def copyToPath (self, destinationPath, overwrite=False)
 Copy the file to given path. More...
 
def remove (self, raiseException=False)
 Remove the file. More...
 
def write (self, line, append=True)
 Write given line into the file. More...
 
def writeLines (self, lines, append=True)
 Write given lines into the file. More...
 
def read (self)
 Read content of the file. More...
 
def readLines (self)
 Read lines. More...
 
def lineCount (self)
 Get line count of the file. More...
 
def create (cls, absFile, overwrite=False, binary=False)
 Create a file and return a sFileSystem.fileLib.File instance for it. More...
 
def file (self)
 Absolute path of the file. More...
 
def directory (self)
 Directory where the file is located in. More...
 
def fileName (self)
 Name of the file with it's extension. More...
 
def baseName (self)
 Name of the file without extension, base name. More...
 
def extension (self)
 File's extension. More...
 
def size (self)
 File size in bytes. More...
 
def sizeStr (self)
 File size as human readable string. More...
 
def content (self)
 Content of the file. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sFileSystem.fileLib.File
def fileExists (absFile)
 Check whether the given file exists. More...
 
def getFileSizeStr (size, precision=2)
 Get given byte size in human readable string. More...
 
def replaceExtension (absFile, newExtension)
 Replace given files extension with given extension. More...
 

Detailed Description

[ CLASS ] - Class to operate on JSON files.

Constructor & Destructor Documentation

◆ __init__()

def sFileSystem.jsonFileLib.JSONFile.__init__ (   self,
  absFile = None 
)

Constructor.

Parameters
absFile[ str | None | in ] - Absolute path of the file.
Exceptions
N/A
Returns
None - None.

Member Function Documentation

◆ setContent()

def sFileSystem.jsonFileLib.JSONFile.setContent (   self,
  content 
)

Set JSON content.

Parameters
content[ variant | None | in ] - Value to be set.
Exceptions
N/A
Returns
None - None.

◆ asStr()

def sFileSystem.jsonFileLib.JSONFile.asStr (   self)

Get string representation.

Exceptions
N/A
Returns
str - File info

◆ setFile()

def sFileSystem.jsonFileLib.JSONFile.setFile (   self,
  absFile 
)

Set JSON file.

Parameters
absFile[ str | None | in ] - Absolute path of the file.
Exceptions
N/A
Returns
bool - Result, returns False is the file doesn't exist.

◆ write()

def sFileSystem.jsonFileLib.JSONFile.write (   self,
  indent = None 
)

Write the content into the file.

Parameters
indent[ int | None | in ] - Indentation.
Exceptions
N/A
Returns
bool - Result.

◆ read()

def sFileSystem.jsonFileLib.JSONFile.read (   self)

Read the content of the file and store it in content member.

Exceptions
N/A
Returns
variant - Content.

The documentation for this class was generated from the following file: