- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

# JFileSystem Class Reference

`#include <JFileSystem.h>`

Collaboration diagram for JFileSystem:

List of all members.

## Public Member Functions
bool | AttachZipFile (const string &zipfile, char *password=NULL)
void | DetachZipFile ()
bool | OpenFile (const string &filename)
int | ReadFile (void *buffer, int size)
int | GetFileSize ()
void | CloseFile ()
void | SetResourceRoot (const string &resourceRoot)
## Static Public Member Functions
static JFileSystem * | GetInstance ()

## Detailed Description

Interface for low level file access with ZIP archive support. All file operations in JGE are handled through this class so if a ZIP archive is attached, all the resources will be loaded from the archive file.

## Member Function Documentation

static JFileSystem* JFileSystem::GetInstance | ( |  | ) | `[static]`

Get the singleton instance

bool JFileSystem::AttachZipFile | ( | const string & | zipfile,
|  | char * | password = `NULL` |
| ) |  |  |

Attach ZIP archive to the file system.

Parameters:

  | zipfile | - Name of ZIP archive.
  | password | - Password for the ZIP archive. Default is NULL.

Returns:
  Status of the attach operation.

void JFileSystem::DetachZipFile | ( |  | ) |

Release the attached ZIP archive.

bool JFileSystem::OpenFile | ( | const string & | filename | ) |

Open file for reading.

int JFileSystem::ReadFile | ( | void * | buffer,
|  | int | size |
| ) |  |  |

Read data from file.

Parameters:

  | buffer | - Buffer for reading.
  | size | - Number of bytes to read.

Returns:
  Number of bytes read.

int JFileSystem::GetFileSize | ( |  | ) |

Get size of file.

void JFileSystem::CloseFile | ( |  | ) |

Close file.

void JFileSystem::SetResourceRoot | ( | const string & | resourceRoot | ) |

Set root for all the following file operations

- New root.