crystalspace.jbind.impl.csutil.vfs
Class csFile

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.csutil.vfs.csFile
All Implemented Interfaces:
iBase, iFile, iPointer

public class csFile
extends csBase
implements iFile

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csFile(iPointer nPointer)
           
 
Method Summary
 boolean atEOF()
          Replacement for standard feof();.
 void flush()
          Flush stream.
 iDataBuffer getAllData()
          Request whole content of the file as a single data buffer.
 iDataBuffer getAllData(boolean nullterm)
          Request whole content of the file as a single data buffer.
 java.lang.String getName()
          Query file name (in VFS);.
 int getPos()
          Query current file pointer.
 int getSize()
          Query file size.
 int getStatus()
          Check (and clear); file last error status.
 int getVersion()
          Return the version of the interface
protected  boolean isNativePointerValidSafe(long pointer)
           
 int read(byte[] Data)
          Replacement for standard fread();.
 boolean setPos(int newpos)
          Set new file pointer.
 int Write(byte[] Data)
          Replacement for standard fwrite();.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csFile

public csFile(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase
See Also:
iBase.getVersion()

getName

public java.lang.String getName()
Description copied from interface: iFile
Query file name (in VFS);. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getName in interface iFile
Specified by:
getName in class csBase
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

atEOF

public boolean atEOF()
Description copied from interface: iFile
Replacement for standard feof();. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
atEOF in interface iFile
Returns:
See Also:
iFile.atEOF()

flush

public void flush()
Description copied from interface: iFile
Flush stream. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
flush in interface iFile
See Also:
iFile.flush()

getAllData

public iDataBuffer getAllData()
Description copied from interface: iFile
Request whole content of the file as a single data buffer. Parameters: nullterm Set this to true if you want a null char to be appended to the buffer (e.g. for use with string functions.); Remarks: Null-termination might have a performance penalty (dependent on where the file is stored.); Use only when needed. Returns: The complete data contained in the file, or 0 if this doesn't support this function (e.g. write-opened VFS files.); Don't modify the contained data! Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getAllData in interface iFile
Returns:
See Also:
iFile.getAllData()

getAllData

public iDataBuffer getAllData(boolean nullterm)
Description copied from interface: iFile
Request whole content of the file as a single data buffer. Parameters: nullterm Set this to true if you want a null char to be appended to the buffer (e.g. for use with string functions.); Remarks: Null-termination might have a performance penalty (dependent on where the file is stored.); Use only when needed. Returns: The complete data contained in the file, or 0 if this doesn't support this function (e.g. write-opened VFS files.); Don't modify the contained data! Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getAllData in interface iFile
Parameters:
nullterm -
Returns:
See Also:
iFile.getAllData(boolean)

getPos

public int getPos()
Description copied from interface: iFile
Query current file pointer. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getPos in interface iFile
Returns:
See Also:
iFile.getPos()

getSize

public int getSize()
Description copied from interface: iFile
Query file size. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getSize in interface iFile
Returns:
See Also:
iFile.getSize()

getStatus

public int getStatus()
Description copied from interface: iFile
Check (and clear); file last error status. See also: VFS_STATUS_ACCESSDENIED Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
getStatus in interface iFile
Returns:
See Also:
iFile.getStatus()

read

public int read(byte[] Data)
Description copied from interface: iFile
Replacement for standard fread();. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
read in interface iFile
Parameters:
Data -
Returns:
See Also:
iFile.read(byte[])

setPos

public boolean setPos(int newpos)
Description copied from interface: iFile
Set new file pointer. Parameters: newpos New position in file. Returns: Whether the position was successfully changed. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
setPos in interface iFile
Parameters:
newpos -
Returns:
See Also:
iFile.setPos(int)

Write

public int Write(byte[] Data)
Description copied from interface: iFile
Replacement for standard fwrite();. Implemented in csMemFile, csPhysicalFile, and csFile.

Specified by:
Write in interface iFile
Parameters:
Data -
Returns:
See Also:
iFile.Write(byte[])