Interface FileContentSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods forreading and writing files. The directory associated with this session is the current working directory and any relative path names provided are with respect to this directory.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can access files in this directory.booleanTests if this user can update this file.getBlockingInputStream(String name) Gets the input stream for reading this file.Gets the directory associated with this session.Gets theIdof this directory.getInputStream(String name) Gets the input stream for reading a file.getOutputStream(String name) Gets an output stream for writing to this file, replacing any existing contents.Gets an output stream for appending to this file.voidUpdates the modified time of a file to be the current time.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getDirectoryId
Id getDirectoryId()Gets theIdof this directory.- Returns:
- the
Idof this directory - Compliance:
mandatory- This method must be implemented.
-
getDirectory
Gets the directory associated with this session.- Returns:
- the directory associated with this session
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canReadFiles
boolean canReadFiles()Tests if this user can access files in this directory. A return of true does not guarantee successful authorization. A return of false indicates that it is known accessing this file will result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer read operations to unauthorized users.- Returns:
falseif file access is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getInputStream
DataInputStream getInputStream(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the input stream for reading a file. The input stream reads until the end of the file.- Parameters:
name- the relative or absolute path name- Returns:
- the input stream for reading this file
- Throws:
NotFoundException-nameis not foundNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBlockingInputStream
DataInputStream getBlockingInputStream(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the input stream for reading this file. The returned input stream, once it reaches the end of the file, blocks for new content that may be later appended to the file.- Parameters:
name- the relative or absolute path name- Returns:
- the input stream for reading this file
- Throws:
NotFoundException-nameis not foundNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canWriteFiles
boolean canWriteFiles()Tests if this user can update this file. A return of true does not guarantee successful authorization. A return of false indicates that it is known writing to this this file will result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer write operations to unauthorized users.- Returns:
falseif file writing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOutputStream
DataOutputStream getOutputStream(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets an output stream for writing to this file, replacing any existing contents.- Parameters:
name- the relative or absolute path name- Returns:
- the output stream for writing to this file
- Throws:
NotFoundException-nameis not foundNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getOutputStreamForAppend
DataOutputStream getOutputStreamForAppend(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets an output stream for appending to this file.- Parameters:
name- the relative or absolute path name- Returns:
- the output stream for appending to this file
- Throws:
NotFoundException-nameis not foundNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
touch
void touch(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Updates the modified time of a file to be the current time.- Parameters:
name- the relative or absolute path name- Throws:
NotFoundException-nameis not foundNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-