sbFileUtils.h File Reference
#include <nsCOMPtr.h>
#include <nsCRT.h>
#include <nsIFile.h>
#include <nsIInputStream.h>
#include <nsIOutputStream.h>
#include <nsStringGlue.h>
#include <sbMemoryUtils.h>
Include dependency graph for sbFileUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SB_DEFAULT_FILE_PERMISSIONS   0644
 
#define SB_DEFAULT_DIRECTORY_PERMISSIONS   0755
 
#define SB_FILE_BAD_CHARACTERS   FILE_ILLEGAL_CHARACTERS FILE_PATH_SEPARATOR
 
#define SB_FILE_BAD_CHARACTERS_ALL_PLATFORMS   CONTROL_CHARACTERS "/\\:*?\"<>|"
 

Functions

nsresult sbOpenInputStream (nsAString const &aPath, nsIInputStream **aStream)
 
nsresult sbOpenInputStream (nsIURI *aURI, nsIInputStream **aStream)
 
nsresult sbOpenInputStream (nsIFile *aFile, nsIInputStream **aStream)
 
nsresult sbOpenOutputStream (nsIFile *aFile, nsIOutputStream **aStream)
 
nsresult sbOpenOutputStream (nsAString const &aPath, nsIOutputStream **aStream)
 
nsresult sbReadFile (nsIFile *aFile, nsACString &aBuffer)
 
nsresult sbConsumeStream (nsIInputStream *aSource, PRUint32 aMaxCount, nsACString &aBuffer)
 
nsresult sbNewFileURI (nsIFile *aFile, nsIURI **aURI)
 
void RemoveBadFileNameCharacters (nsAString &aFileName, PRBool aAllPlatforms)
 
 SB_AUTO_NULL_CLASS (sbAutoInputStream, nsCOMPtr< nsIInputStream >, mValue->Close())
 
 SB_AUTO_NULL_CLASS (sbAutoOutputStream, nsCOMPtr< nsIOutputStream >, mValue->Close())
 
 SB_AUTO_NULL_CLASS (sbAutoRemoveFile, nsCOMPtr< nsIFile >, mValue->Remove(PR_FALSE))
 

Macro Definition Documentation

#define SB_DEFAULT_DIRECTORY_PERMISSIONS   0755

Definition at line 124 of file sbFileUtils.h.

#define SB_DEFAULT_FILE_PERMISSIONS   0644

Definition at line 123 of file sbFileUtils.h.

#define SB_FILE_BAD_CHARACTERS   FILE_ILLEGAL_CHARACTERS FILE_PATH_SEPARATOR

Definition at line 138 of file sbFileUtils.h.

#define SB_FILE_BAD_CHARACTERS_ALL_PLATFORMS   CONTROL_CHARACTERS "/\\:*?\"<>|"

Definition at line 139 of file sbFileUtils.h.

Function Documentation

void RemoveBadFileNameCharacters ( nsAString &  aFileName,
PRBool  aAllPlatforms 
)

Remove all bad file name characters from the file name specified by aFileName. If aAllPlatforms is true, remove characters that are bad on any platform; otherwise, only remove characters that are bad on the current platform.

Parameters
aFileNameFile name from which to remove bad characters.
aAllPlatformsIf true, remove characters that are bad on any platform.

Definition at line 275 of file sbFileUtils.cpp.

SB_AUTO_NULL_CLASS ( sbAutoInputStream  ,
nsCOMPtr< nsIInputStream >  ,
mValue->  Close() 
)
SB_AUTO_NULL_CLASS ( sbAutoOutputStream  ,
nsCOMPtr< nsIOutputStream >  ,
mValue->  Close() 
)
SB_AUTO_NULL_CLASS ( sbAutoRemoveFile  ,
nsCOMPtr< nsIFile >  ,
mValue->  RemovePR_FALSE 
)
nsresult sbConsumeStream ( nsIInputStream *  aSource,
PRUint32  aMaxCount,
nsACString &  aBuffer 
)

From xpcom/io/nsStreamUtils.h

Definition at line 166 of file sbFileUtils.cpp.

Here is the caller graph for this function:

nsresult sbNewFileURI ( nsIFile *  aFile,
nsIURI **  aURI 
)

Return in aURI a URI object for the file specified by aFile. Avoids Songbird bug 6227 in nsIIOService.newFileURI.

Parameters
aFileFile for which to get URI.
aURIReturned file URI.

Definition at line 216 of file sbFileUtils.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbOpenInputStream ( nsAString const &  aPath,
nsIInputStream **  aStream 
)

Helper function to open a stream given a file path

Helper functions to open a stream given a file path

Definition at line 47 of file sbFileUtils.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbOpenInputStream ( nsIURI *  aURI,
nsIInputStream **  aStream 
)

Helper function to open a stream given a file URL

Definition at line 64 of file sbFileUtils.cpp.

Here is the call graph for this function:

nsresult sbOpenInputStream ( nsIFile *  aFile,
nsIInputStream **  aStream 
)

Helper function to open a stream given a file

Definition at line 83 of file sbFileUtils.cpp.

nsresult sbOpenOutputStream ( nsIFile *  aFile,
nsIOutputStream **  aStream 
)

Helper function to open an output stream given a file

Definition at line 104 of file sbFileUtils.cpp.

Here is the caller graph for this function:

nsresult sbOpenOutputStream ( nsAString const &  aPath,
nsIOutputStream **  aStream 
)

Helper function to open an output stream given a file path

Definition at line 125 of file sbFileUtils.cpp.

Here is the call graph for this function:

nsresult sbReadFile ( nsIFile *  aFile,
nsACString &  aBuffer 
)

Read a file into a buffer

Definition at line 143 of file sbFileUtils.cpp.

Here is the call graph for this function:

Here is the caller graph for this function: