Package org.astrogrid.samp.hub
Class LockWriter
java.lang.Object
org.astrogrid.samp.hub.LockWriter
Writes records to a SAMP Standard Profile hub lockfile.
- Since:
- 15 Jul 2008
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionLockWriter(OutputStream out) Constructs a writer for writing to a given output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the output stream.static voidsetLockPermissions(File file) Sets the permissions on a given file suitably for a SAMP Standard Profile lockfile.voidwriteAssignment(String name, String value) Writes a single assignment to the lockfile.voidwriteAssignments(Map map) Writes all the assignments in a given map to the lockfile.voidwriteComment(String comment) Writes a comment line to the lockfile.voidWrites a blank line to the lockfile.protected voidWrites a line of text to the lockfile, terminated with a line-end.
-
Constructor Details
-
LockWriter
Constructs a writer for writing to a given output stream.- Parameters:
out- output stream
-
-
Method Details
-
writeAssignments
Writes all the assignments in a given map to the lockfile.- Parameters:
map- assignment set to output- Throws:
IOException
-
writeAssignment
Writes a single assignment to the lockfile.- Parameters:
name- assignment keyvalue- assignment value- Throws:
IOException
-
writeComment
Writes a comment line to the lockfile.- Parameters:
comment- comment text- Throws:
IOException
-
writeLine
Writes a blank line to the lockfile.- Throws:
IOException
-
writeLine
Writes a line of text to the lockfile, terminated with a line-end.- Parameters:
line- line to write- Throws:
IOException
-
close
Closes the output stream. May be required to ensure that all data is written.- Throws:
IOException
-
setLockPermissions
Sets the permissions on a given file suitably for a SAMP Standard Profile lockfile. This means that nobody apart from the file's owner can read it.- Parameters:
file- file to set access permissions on- Throws:
IOException
-