|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 | +<!-- NewPage --> |
| 3 | +<html lang="de"> |
| 4 | +<head> |
| 5 | +<!-- Generated by javadoc (1.8.0_302) on Tue Aug 31 18:00:46 CEST 2021 --> |
| 6 | +<title>PersistentObjectStorage</title> |
| 7 | +<meta name="date" content="2021-08-31"> |
| 8 | +<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> |
| 9 | +<script type="text/javascript" src="script.js"></script> |
| 10 | +</head> |
| 11 | +<body> |
| 12 | +<script type="text/javascript"><!-- |
| 13 | + try { |
| 14 | + if (location.href.indexOf('is-external=true') == -1) { |
| 15 | + parent.document.title="PersistentObjectStorage"; |
| 16 | + } |
| 17 | + } |
| 18 | + catch(err) { |
| 19 | + } |
| 20 | +//--> |
| 21 | +var methods = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":10,"i5":10,"i6":10,"i7":10}; |
| 22 | +var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| 23 | +var altColor = "altColor"; |
| 24 | +var rowColor = "rowColor"; |
| 25 | +var tableTab = "tableTab"; |
| 26 | +var activeTableTab = "activeTableTab"; |
| 27 | +</script> |
| 28 | +<noscript> |
| 29 | +<div>JavaScript is disabled on your browser.</div> |
| 30 | +</noscript> |
| 31 | +<!-- ======== START OF CLASS DATA ======== --> |
| 32 | +<div class="header"> |
| 33 | +<div class="subTitle">de.stevensolleder.persistentobjectstorage</div> |
| 34 | +<h2 title="Class PersistentObjectStorage" class="title">Class PersistentObjectStorage</h2> |
| 35 | +</div> |
| 36 | +<div class="contentContainer"> |
| 37 | +<ul class="inheritance"> |
| 38 | +<li>java.lang.Object</li> |
| 39 | +<li> |
| 40 | +<ul class="inheritance"> |
| 41 | +<li>de.stevensolleder.persistentobjectstorage.PersistentObjectStorage</li> |
| 42 | +</ul> |
| 43 | +</li> |
| 44 | +</ul> |
| 45 | +<div class="description"> |
| 46 | +<ul class="blockList"> |
| 47 | +<li class="blockList"> |
| 48 | +<hr> |
| 49 | +<br> |
| 50 | +<pre>public class <span class="typeNameLabel">PersistentObjectStorage</span> |
| 51 | +extends java.lang.Object</pre> |
| 52 | +</li> |
| 53 | +</ul> |
| 54 | +</div> |
| 55 | +<div class="summary"> |
| 56 | +<ul class="blockList"> |
| 57 | +<li class="blockList"> |
| 58 | +<!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| 59 | +<ul class="blockList"> |
| 60 | +<li class="blockList"><a name="constructor.summary"> |
| 61 | +<!-- --> |
| 62 | +</a> |
| 63 | +<h3>Constructor Summary</h3> |
| 64 | +<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| 65 | +<caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| 66 | +<tr> |
| 67 | +<th class="colOne" scope="col">Constructor and Description</th> |
| 68 | +</tr> |
| 69 | +<tr class="altColor"> |
| 70 | +<td class="colOne"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#PersistentObjectStorage-java.lang.String-">PersistentObjectStorage</a></span>(java.lang.String directoryName)</code> |
| 71 | +<div class="block">Before you use any other method of this library you have to set a storage path.</div> |
| 72 | +</td> |
| 73 | +</tr> |
| 74 | +</table> |
| 75 | +</li> |
| 76 | +</ul> |
| 77 | +<!-- ========== METHOD SUMMARY =========== --> |
| 78 | +<ul class="blockList"> |
| 79 | +<li class="blockList"><a name="method.summary"> |
| 80 | +<!-- --> |
| 81 | +</a> |
| 82 | +<h3>Method Summary</h3> |
| 83 | +<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| 84 | +<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| 85 | +<tr> |
| 86 | +<th class="colFirst" scope="col">Modifier and Type</th> |
| 87 | +<th class="colLast" scope="col">Method and Description</th> |
| 88 | +</tr> |
| 89 | +<tr id="i0" class="altColor"> |
| 90 | +<td class="colFirst"><code>void</code></td> |
| 91 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#firstStartFinished--">firstStartFinished</a></span>()</code> |
| 92 | +<div class="block">If called, an empty file <code>notFirstStart</code> is created in the storage path.</div> |
| 93 | +</td> |
| 94 | +</tr> |
| 95 | +<tr id="i1" class="rowColor"> |
| 96 | +<td class="colFirst"><code>java.lang.String</code></td> |
| 97 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#getStoragePath--">getStoragePath</a></span>()</code> |
| 98 | +<div class="block">Get the current set storage path as a <code>String</code>.</div> |
| 99 | +</td> |
| 100 | +</tr> |
| 101 | +<tr id="i2" class="altColor"> |
| 102 | +<td class="colFirst"><code>boolean</code></td> |
| 103 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#isFirstStart--">isFirstStart</a></span>()</code> |
| 104 | +<div class="block">Checks if the file <code>notFirstStart</code> exists, so you can check if the application was started once before.</div> |
| 105 | +</td> |
| 106 | +</tr> |
| 107 | +<tr id="i3" class="rowColor"> |
| 108 | +<td class="colFirst"><code>static void</code></td> |
| 109 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#main-java.lang.String:A-">main</a></span>(java.lang.String[] args)</code> </td> |
| 110 | +</tr> |
| 111 | +<tr id="i4" class="altColor"> |
| 112 | +<td class="colFirst"><code><T extends java.io.Serializable><br>T</code></td> |
| 113 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#read-java.lang.String-">read</a></span>(java.lang.String fileName)</code> |
| 114 | +<div class="block">Reads an object of a given type from a <code>File</code>.</div> |
| 115 | +</td> |
| 116 | +</tr> |
| 117 | +<tr id="i5" class="rowColor"> |
| 118 | +<td class="colFirst"><code>void</code></td> |
| 119 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#resetAllData--">resetAllData</a></span>()</code> |
| 120 | +<div class="block">Deletes the directory where all files created with this library are stored.</div> |
| 121 | +</td> |
| 122 | +</tr> |
| 123 | +<tr id="i6" class="altColor"> |
| 124 | +<td class="colFirst"><code>boolean</code></td> |
| 125 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#resetFirstStart--">resetFirstStart</a></span>()</code> |
| 126 | +<div class="block">Deletes the file <code>notFirstStart</code> in the storage path if it exists.</div> |
| 127 | +</td> |
| 128 | +</tr> |
| 129 | +<tr id="i7" class="rowColor"> |
| 130 | +<td class="colFirst"><code><T extends java.io.Serializable><br>void</code></td> |
| 131 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../de/stevensolleder/persistentobjectstorage/PersistentObjectStorage.html#write-T-java.lang.String-">write</a></span>(T object, |
| 132 | + java.lang.String fileName)</code> |
| 133 | +<div class="block">Writes an object of a given type to a <code>File</code>.</div> |
| 134 | +</td> |
| 135 | +</tr> |
| 136 | +</table> |
| 137 | +<ul class="blockList"> |
| 138 | +<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| 139 | +<!-- --> |
| 140 | +</a> |
| 141 | +<h3>Methods inherited from class java.lang.Object</h3> |
| 142 | +<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| 143 | +</ul> |
| 144 | +</li> |
| 145 | +</ul> |
| 146 | +</li> |
| 147 | +</ul> |
| 148 | +</div> |
| 149 | +<div class="details"> |
| 150 | +<ul class="blockList"> |
| 151 | +<li class="blockList"> |
| 152 | +<!-- ========= CONSTRUCTOR DETAIL ======== --> |
| 153 | +<ul class="blockList"> |
| 154 | +<li class="blockList"><a name="constructor.detail"> |
| 155 | +<!-- --> |
| 156 | +</a> |
| 157 | +<h3>Constructor Detail</h3> |
| 158 | +<a name="PersistentObjectStorage-java.lang.String-"> |
| 159 | +<!-- --> |
| 160 | +</a> |
| 161 | +<ul class="blockListLast"> |
| 162 | +<li class="blockList"> |
| 163 | +<h4>PersistentObjectStorage</h4> |
| 164 | +<pre>public PersistentObjectStorage(java.lang.String directoryName)</pre> |
| 165 | +<div class="block">Before you use any other method of this library you have to set a storage path. |
| 166 | + The storage path is always a directory with <code>directoryName</code> which will be created in the home path of the current user. |
| 167 | + <code>directoryName</code> gets trimmed.</div> |
| 168 | +<dl> |
| 169 | +<dt><span class="paramLabel">Parameters:</span></dt> |
| 170 | +<dd><code>directoryName</code> - The name of the directory inside the home directory of the current user where all files are created and read with this library.</dd> |
| 171 | +<dt><span class="throwsLabel">Throws:</span></dt> |
| 172 | +<dd><code>java.lang.NullPointerException</code> - If <code>directoryName</code> is null</dd> |
| 173 | +<dd><code>java.lang.IllegalArgumentException</code> - If <code>directoryName</code> is empty</dd> |
| 174 | +</dl> |
| 175 | +</li> |
| 176 | +</ul> |
| 177 | +</li> |
| 178 | +</ul> |
| 179 | +<!-- ============ METHOD DETAIL ========== --> |
| 180 | +<ul class="blockList"> |
| 181 | +<li class="blockList"><a name="method.detail"> |
| 182 | +<!-- --> |
| 183 | +</a> |
| 184 | +<h3>Method Detail</h3> |
| 185 | +<a name="getStoragePath--"> |
| 186 | +<!-- --> |
| 187 | +</a> |
| 188 | +<ul class="blockList"> |
| 189 | +<li class="blockList"> |
| 190 | +<h4>getStoragePath</h4> |
| 191 | +<pre>public java.lang.String getStoragePath()</pre> |
| 192 | +<div class="block">Get the current set storage path as a <code>String</code>.</div> |
| 193 | +<dl> |
| 194 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 195 | +<dd>Current set storage path</dd> |
| 196 | +</dl> |
| 197 | +</li> |
| 198 | +</ul> |
| 199 | +<a name="isFirstStart--"> |
| 200 | +<!-- --> |
| 201 | +</a> |
| 202 | +<ul class="blockList"> |
| 203 | +<li class="blockList"> |
| 204 | +<h4>isFirstStart</h4> |
| 205 | +<pre>public boolean isFirstStart()</pre> |
| 206 | +<div class="block">Checks if the file <code>notFirstStart</code> exists, so you can check if the application was started once before.</div> |
| 207 | +<dl> |
| 208 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 209 | +<dd>True if file <code>notFirstStart</code> doesn't exist in the storage path</dd> |
| 210 | +</dl> |
| 211 | +</li> |
| 212 | +</ul> |
| 213 | +<a name="firstStartFinished--"> |
| 214 | +<!-- --> |
| 215 | +</a> |
| 216 | +<ul class="blockList"> |
| 217 | +<li class="blockList"> |
| 218 | +<h4>firstStartFinished</h4> |
| 219 | +<pre>public void firstStartFinished() |
| 220 | + throws java.io.IOException</pre> |
| 221 | +<div class="block">If called, an empty file <code>notFirstStart</code> is created in the storage path. |
| 222 | + From now on <code>isFirstStart</code> returns false.</div> |
| 223 | +<dl> |
| 224 | +<dt><span class="throwsLabel">Throws:</span></dt> |
| 225 | +<dd><code>java.io.IOException</code> - If an I/O error occurred</dd> |
| 226 | +</dl> |
| 227 | +</li> |
| 228 | +</ul> |
| 229 | +<a name="resetFirstStart--"> |
| 230 | +<!-- --> |
| 231 | +</a> |
| 232 | +<ul class="blockList"> |
| 233 | +<li class="blockList"> |
| 234 | +<h4>resetFirstStart</h4> |
| 235 | +<pre>public boolean resetFirstStart()</pre> |
| 236 | +<div class="block">Deletes the file <code>notFirstStart</code> in the storage path if it exists. |
| 237 | + From now on <code>isFirstStart</code> returns true.</div> |
| 238 | +<dl> |
| 239 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 240 | +<dd>True if notFirstStart file existed and was successfully deleted, else false</dd> |
| 241 | +</dl> |
| 242 | +</li> |
| 243 | +</ul> |
| 244 | +<a name="read-java.lang.String-"> |
| 245 | +<!-- --> |
| 246 | +</a> |
| 247 | +<ul class="blockList"> |
| 248 | +<li class="blockList"> |
| 249 | +<h4>read</h4> |
| 250 | +<pre>public <T extends java.io.Serializable> T read(java.lang.String fileName) |
| 251 | + throws java.io.IOException, |
| 252 | + java.lang.ClassNotFoundException</pre> |
| 253 | +<div class="block">Reads an object of a given type from a <code>File</code>.</div> |
| 254 | +<dl> |
| 255 | +<dt><span class="paramLabel">Type Parameters:</span></dt> |
| 256 | +<dd><code>T</code> - The type of the object that is read</dd> |
| 257 | +<dt><span class="paramLabel">Parameters:</span></dt> |
| 258 | +<dd><code>fileName</code> - The name of the file an object should be read from</dd> |
| 259 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 260 | +<dd>Object of a given type</dd> |
| 261 | +<dt><span class="throwsLabel">Throws:</span></dt> |
| 262 | +<dd><code>java.lang.NullPointerException</code> - If <code>fileName</code> is null</dd> |
| 263 | +<dd><code>java.io.FileNotFoundException</code> - If the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.</dd> |
| 264 | +<dd><code>java.io.IOException</code> - If an I/O error occurred</dd> |
| 265 | +<dd><code>java.lang.ClassNotFoundException</code> - Class of a serialized object cannot be found</dd> |
| 266 | +<dd><code>java.io.InvalidClassException</code> - Something is wrong with a class used by serialization</dd> |
| 267 | +<dd><code>java.io.StreamCorruptedException</code> - Control information in the stream is inconsistent</dd> |
| 268 | +<dd><code>java.io.OptionalDataException</code> - Primitive data was found in the stream instead of objects</dd> |
| 269 | +<dd><code>java.lang.ClassCastException</code> - If wrong class for T is given</dd> |
| 270 | +</dl> |
| 271 | +</li> |
| 272 | +</ul> |
| 273 | +<a name="write-java.io.Serializable-java.lang.String-"> |
| 274 | +<!-- --> |
| 275 | +</a><a name="write-T-java.lang.String-"> |
| 276 | +<!-- --> |
| 277 | +</a> |
| 278 | +<ul class="blockList"> |
| 279 | +<li class="blockList"> |
| 280 | +<h4>write</h4> |
| 281 | +<pre>public <T extends java.io.Serializable> void write(T object, |
| 282 | + java.lang.String fileName) |
| 283 | + throws java.io.IOException</pre> |
| 284 | +<div class="block">Writes an object of a given type to a <code>File</code>.</div> |
| 285 | +<dl> |
| 286 | +<dt><span class="paramLabel">Type Parameters:</span></dt> |
| 287 | +<dd><code>T</code> - The type of the object that is written</dd> |
| 288 | +<dt><span class="paramLabel">Parameters:</span></dt> |
| 289 | +<dd><code>object</code> - The object of a given type that should be written</dd> |
| 290 | +<dd><code>fileName</code> - The name of the <code>File</code> the object should be written to</dd> |
| 291 | +<dt><span class="throwsLabel">Throws:</span></dt> |
| 292 | +<dd><code>java.lang.NullPointerException</code> - If <code>fileName</code> is null</dd> |
| 293 | +<dd><code>java.io.FileNotFoundException</code> - If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason</dd> |
| 294 | +<dd><code>java.io.InvalidClassException</code> - Something is wrong with a class used by serialization</dd> |
| 295 | +<dd><code>java.io.IOException</code> - If an I/O error occurred</dd> |
| 296 | +</dl> |
| 297 | +</li> |
| 298 | +</ul> |
| 299 | +<a name="resetAllData--"> |
| 300 | +<!-- --> |
| 301 | +</a> |
| 302 | +<ul class="blockList"> |
| 303 | +<li class="blockList"> |
| 304 | +<h4>resetAllData</h4> |
| 305 | +<pre>public void resetAllData()</pre> |
| 306 | +<div class="block">Deletes the directory where all files created with this library are stored. |
| 307 | + From now on <code>isFirstStart</code> returns true.</div> |
| 308 | +</li> |
| 309 | +</ul> |
| 310 | +<a name="main-java.lang.String:A-"> |
| 311 | +<!-- --> |
| 312 | +</a> |
| 313 | +<ul class="blockListLast"> |
| 314 | +<li class="blockList"> |
| 315 | +<h4>main</h4> |
| 316 | +<pre>public static void main(java.lang.String[] args)</pre> |
| 317 | +</li> |
| 318 | +</ul> |
| 319 | +</li> |
| 320 | +</ul> |
| 321 | +</li> |
| 322 | +</ul> |
| 323 | +</div> |
| 324 | +</div> |
| 325 | +<!-- ========= END OF CLASS DATA ========= --> |
| 326 | +</body> |
| 327 | +</html> |
0 commit comments