SquidStorage.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc -->
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7. <title>SquidStorage (squidlib-extra 3.0.0-SNAPSHOT)</title>
  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="SquidStorage (squidlib-extra 3.0.0-SNAPSHOT)";
  16. }
  17. }
  18. catch(err) {
  19. }
  20. //-->
  21. var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10};
  22. var tabs = {65535:["t0","All 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 TOP NAVBAR ======= -->
  32. <div class="topNav"><a name="navbar.top">
  33. <!-- -->
  34. </a>
  35. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  36. <a name="navbar.top.firstrow">
  37. <!-- -->
  38. </a>
  39. <ul class="navList" title="Navigation">
  40. <li><a href="../squidpony/package-summary.html">Package</a></li>
  41. <li class="navBarCell1Rev">Class</li>
  42. <li><a href="class-use/SquidStorage.html">Use</a></li>
  43. <li><a href="package-tree.html">Tree</a></li>
  44. <li><a href="../deprecated-list.html">Deprecated</a></li>
  45. <li><a href="../index-files/index-1.html">Index</a></li>
  46. <li><a href="../help-doc.html">Help</a></li>
  47. </ul>
  48. </div>
  49. <div class="subNav">
  50. <ul class="navList">
  51. <li>Prev&nbsp;Class</li>
  52. <li>Next&nbsp;Class</li>
  53. </ul>
  54. <ul class="navList">
  55. <li><a href="../index.html?squidpony/SquidStorage.html" target="_top">Frames</a></li>
  56. <li><a href="SquidStorage.html" target="_top">No&nbsp;Frames</a></li>
  57. </ul>
  58. <ul class="navList" id="allclasses_navbar_top">
  59. <li><a href="../allclasses-noframe.html">All&nbsp;Classes</a></li>
  60. </ul>
  61. <div>
  62. <script type="text/javascript"><!--
  63. allClassesLink = document.getElementById("allclasses_navbar_top");
  64. if(window==top) {
  65. allClassesLink.style.display = "block";
  66. }
  67. else {
  68. allClassesLink.style.display = "none";
  69. }
  70. //-->
  71. </script>
  72. </div>
  73. <div>
  74. <ul class="subNavList">
  75. <li>Summary:&nbsp;</li>
  76. <li>Nested&nbsp;|&nbsp;</li>
  77. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  78. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  79. <li><a href="#method.summary">Method</a></li>
  80. </ul>
  81. <ul class="subNavList">
  82. <li>Detail:&nbsp;</li>
  83. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  84. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  85. <li><a href="#method.detail">Method</a></li>
  86. </ul>
  87. </div>
  88. <a name="skip.navbar.top">
  89. <!-- -->
  90. </a></div>
  91. <!-- ========= END OF TOP NAVBAR ========= -->
  92. <!-- ======== START OF CLASS DATA ======== -->
  93. <div class="header">
  94. <div class="subTitle">squidpony</div>
  95. <h2 title="Class SquidStorage" class="title">Class SquidStorage</h2>
  96. </div>
  97. <div class="contentContainer">
  98. <ul class="inheritance">
  99. <li><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
  100. <li>
  101. <ul class="inheritance">
  102. <li>squidpony.SquidStorage</li>
  103. </ul>
  104. </li>
  105. </ul>
  106. <div class="description">
  107. <ul class="blockList">
  108. <li class="blockList">
  109. <hr>
  110. <br>
  111. <pre>@Beta
  112. public class <a href="../src-html/squidpony/SquidStorage.html#line.22">SquidStorage</a>
  113. extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
  114. <div class="block">Helps games store information in libGDX's Preferences class as Strings, then get it back out.
  115. Created by Tommy Ettinger on 9/16/2016.</div>
  116. </li>
  117. </ul>
  118. </div>
  119. <div class="summary">
  120. <ul class="blockList">
  121. <li class="blockList">
  122. <!-- =========== FIELD SUMMARY =========== -->
  123. <ul class="blockList">
  124. <li class="blockList"><a name="field.summary">
  125. <!-- -->
  126. </a>
  127. <h3>Field Summary</h3>
  128. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
  129. <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
  130. <tr>
  131. <th class="colFirst" scope="col">Modifier and Type</th>
  132. <th class="colLast" scope="col">Field and Description</th>
  133. </tr>
  134. <tr class="altColor">
  135. <td class="colFirst"><code>boolean</code></td>
  136. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#compress">compress</a></span></code>&nbsp;</td>
  137. </tr>
  138. <tr class="rowColor">
  139. <td class="colFirst"><code>protected squidpony.squidmath.OrderedMap&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
  140. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#contents">contents</a></span></code>&nbsp;</td>
  141. </tr>
  142. <tr class="altColor">
  143. <td class="colFirst"><code>com.badlogic.gdx.utils.Json</code></td>
  144. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#json">json</a></span></code>&nbsp;</td>
  145. </tr>
  146. <tr class="rowColor">
  147. <td class="colFirst"><code>com.badlogic.gdx.Preferences</code></td>
  148. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#preferences">preferences</a></span></code>&nbsp;</td>
  149. </tr>
  150. <tr class="altColor">
  151. <td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
  152. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#storageName">storageName</a></span></code>&nbsp;</td>
  153. </tr>
  154. </table>
  155. </li>
  156. </ul>
  157. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  158. <ul class="blockList">
  159. <li class="blockList"><a name="constructor.summary">
  160. <!-- -->
  161. </a>
  162. <h3>Constructor Summary</h3>
  163. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
  164. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  165. <tr>
  166. <th class="colOne" scope="col">Constructor and Description</th>
  167. </tr>
  168. <tr class="altColor">
  169. <td class="colOne"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#SquidStorage--">SquidStorage</a></span>()</code>
  170. <div class="block">Please don't use this constructor if possible; it simply calls <a href="../squidpony/SquidStorage.html#SquidStorage-java.lang.String-"><code>SquidStorage(String)</code></a> with the constant
  171. String "nameless".</div>
  172. </td>
  173. </tr>
  174. <tr class="rowColor">
  175. <td class="colOne"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#SquidStorage-java.lang.String-">SquidStorage</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;fileName)</code>
  176. <div class="block">Creates a SquidStorage with the given fileName to save using Preferences from libGDX.</div>
  177. </td>
  178. </tr>
  179. </table>
  180. </li>
  181. </ul>
  182. <!-- ========== METHOD SUMMARY =========== -->
  183. <ul class="blockList">
  184. <li class="blockList"><a name="method.summary">
  185. <!-- -->
  186. </a>
  187. <h3>Method Summary</h3>
  188. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  189. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  190. <tr>
  191. <th class="colFirst" scope="col">Modifier and Type</th>
  192. <th class="colLast" scope="col">Method and Description</th>
  193. </tr>
  194. <tr id="i0" class="altColor">
  195. <td class="colFirst"><code><a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a></code></td>
  196. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#clear--">clear</a></span>()</code>
  197. <div class="block">Clears the current group of objects; recommended if you intend to store under multiple outerName keys.</div>
  198. </td>
  199. </tr>
  200. <tr id="i1" class="rowColor">
  201. <td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
  202. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#get-java.lang.String-java.lang.String-java.lang.Class-">get</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;outerName,
  203. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName,
  204. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;type)</code>
  205. <div class="block">Gets an object from the storage by the given <code>outerName</code> key from <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> and
  206. <code>innerName</code> key from <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>, and uses the class given by <code>type</code> for the
  207. returned value, assuming it matches the object that was originally put with those keys.</div>
  208. </td>
  209. </tr>
  210. <tr id="i2" class="altColor">
  211. <td class="colFirst"><code>int</code></td>
  212. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#preferencesSize--">preferencesSize</a></span>()</code>
  213. <div class="block">Gets the approximate size of the currently-stored preferences.</div>
  214. </td>
  215. </tr>
  216. <tr id="i3" class="rowColor">
  217. <td class="colFirst"><code><a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a></code></td>
  218. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-">put</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName,
  219. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</code>
  220. <div class="block">Prepares to store the Object <code>o</code> to be retrieved with <code>innerName</code> in the current group of objects.</div>
  221. </td>
  222. </tr>
  223. <tr id="i4" class="altColor">
  224. <td class="colFirst"><code><a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a></code></td>
  225. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#remove-java.lang.String-">remove</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName)</code>
  226. <div class="block">Removes one object from the current group by the <code>innerName</code> it was prepared with using
  227. <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>.</div>
  228. </td>
  229. </tr>
  230. <tr id="i5" class="rowColor">
  231. <td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
  232. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#show--">show</a></span>()</code>
  233. <div class="block">Gets a String representation of the data that would be saved when <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> is called.</div>
  234. </td>
  235. </tr>
  236. <tr id="i6" class="altColor">
  237. <td class="colFirst"><code><a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a></code></td>
  238. <td class="colLast"><code><span class="memberNameLink"><a href="../squidpony/SquidStorage.html#store-java.lang.String-">store</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;outerName)</code>
  239. <div class="block">Actually stores all objects that had previously been prepared with <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>, with
  240. <code>outerName</code> used as a key to retrieve any object in the current group.</div>
  241. </td>
  242. </tr>
  243. </table>
  244. <ul class="blockList">
  245. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  246. <!-- -->
  247. </a>
  248. <h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
  249. <code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
  250. </ul>
  251. </li>
  252. </ul>
  253. </li>
  254. </ul>
  255. </div>
  256. <div class="details">
  257. <ul class="blockList">
  258. <li class="blockList">
  259. <!-- ============ FIELD DETAIL =========== -->
  260. <ul class="blockList">
  261. <li class="blockList"><a name="field.detail">
  262. <!-- -->
  263. </a>
  264. <h3>Field Detail</h3>
  265. <a name="preferences">
  266. <!-- -->
  267. </a>
  268. <ul class="blockList">
  269. <li class="blockList">
  270. <h4>preferences</h4>
  271. <pre>public final&nbsp;com.badlogic.gdx.Preferences <a href="../src-html/squidpony/SquidStorage.html#line.23">preferences</a></pre>
  272. </li>
  273. </ul>
  274. <a name="storageName">
  275. <!-- -->
  276. </a>
  277. <ul class="blockList">
  278. <li class="blockList">
  279. <h4>storageName</h4>
  280. <pre>public final&nbsp;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../src-html/squidpony/SquidStorage.html#line.24">storageName</a></pre>
  281. </li>
  282. </ul>
  283. <a name="json">
  284. <!-- -->
  285. </a>
  286. <ul class="blockList">
  287. <li class="blockList">
  288. <h4>json</h4>
  289. <pre>public final&nbsp;com.badlogic.gdx.utils.Json <a href="../src-html/squidpony/SquidStorage.html#line.25">json</a></pre>
  290. </li>
  291. </ul>
  292. <a name="contents">
  293. <!-- -->
  294. </a>
  295. <ul class="blockList">
  296. <li class="blockList">
  297. <h4>contents</h4>
  298. <pre>protected&nbsp;squidpony.squidmath.OrderedMap&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt; <a href="../src-html/squidpony/SquidStorage.html#line.26">contents</a></pre>
  299. </li>
  300. </ul>
  301. <a name="compress">
  302. <!-- -->
  303. </a>
  304. <ul class="blockListLast">
  305. <li class="blockList">
  306. <h4>compress</h4>
  307. <pre>public&nbsp;boolean <a href="../src-html/squidpony/SquidStorage.html#line.27">compress</a></pre>
  308. </li>
  309. </ul>
  310. </li>
  311. </ul>
  312. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  313. <ul class="blockList">
  314. <li class="blockList"><a name="constructor.detail">
  315. <!-- -->
  316. </a>
  317. <h3>Constructor Detail</h3>
  318. <a name="SquidStorage--">
  319. <!-- -->
  320. </a>
  321. <ul class="blockList">
  322. <li class="blockList">
  323. <h4>SquidStorage</h4>
  324. <pre>public&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.35">SquidStorage</a>()</pre>
  325. <div class="block">Please don't use this constructor if possible; it simply calls <a href="../squidpony/SquidStorage.html#SquidStorage-java.lang.String-"><code>SquidStorage(String)</code></a> with the constant
  326. String "nameless". This could easily overlap with other files/sections in Preferences, so you should always
  327. prefer giving a String argument to the constructor, typically the name of the game.</div>
  328. <dl>
  329. <dt><span class="seeLabel">See Also:</span></dt>
  330. <dd><a href="../squidpony/SquidStorage.html#SquidStorage-java.lang.String-"><code>the recommended constructor to use</code></a></dd>
  331. </dl>
  332. </li>
  333. </ul>
  334. <a name="SquidStorage-java.lang.String-">
  335. <!-- -->
  336. </a>
  337. <ul class="blockListLast">
  338. <li class="blockList">
  339. <h4>SquidStorage</h4>
  340. <pre>public&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.59">SquidStorage</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;fileName)</pre>
  341. <div class="block">Creates a SquidStorage with the given fileName to save using Preferences from libGDX. The name should generally
  342. be the name of this game or application, and must be a valid name for a file (so no slashes, backslashes, colons,
  343. semicolons, or commas for certain, and other non-alphanumeric characters are also probably invalid). You should
  344. not assume anything is present in the Preferences storage unless you have put it there, and this applies doubly
  345. to games or applications other than your own; you should avoid values for fileName that might overlap with
  346. another game's Preferences values.
  347. <br>
  348. To organize saved data into sub-sections, you specify logical units (like different players' saved games) with a
  349. String outerName when you call <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a>, and can further distinguish data under the outerName when
  350. you call <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a> to put each individual item into the saved storage with its own innerName.
  351. <br>
  352. Calling this also sets up custom serializers for several important types in SquidLib; char[][], OrderedMap,
  353. IntDoubleOrderedMap, FakeLanguageGen, GreasedRegion, and notably Pattern from RegExodus all have smaller
  354. serialized representations than the default. OrderedMap allows non-String keys, which gets around a limitation in
  355. JSON maps normally, and both FakeLanguageGen and Pattern are amazingly smaller with the custom representation.
  356. The custom char[][] representation is about half the normal size by omitting commas after each char.</div>
  357. <dl>
  358. <dt><span class="paramLabel">Parameters:</span></dt>
  359. <dd><code>fileName</code> - the valid file name to create or open from Preferences; typically the name of the game/app.</dd>
  360. </dl>
  361. </li>
  362. </ul>
  363. </li>
  364. </ul>
  365. <!-- ============ METHOD DETAIL ========== -->
  366. <ul class="blockList">
  367. <li class="blockList"><a name="method.detail">
  368. <!-- -->
  369. </a>
  370. <h3>Method Detail</h3>
  371. <a name="put-java.lang.String-java.lang.Object-">
  372. <!-- -->
  373. </a>
  374. <ul class="blockList">
  375. <li class="blockList">
  376. <h4>put</h4>
  377. <pre>public&nbsp;<a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a>&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.337">put</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName,
  378. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</pre>
  379. <div class="block">Prepares to store the Object <code>o</code> to be retrieved with <code>innerName</code> in the current group of objects.
  380. Does not write to a permanent location until <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> is called. The innerName used to store an
  381. object is required to get it back again, and can also be used to remove it before storing (or storing again).</div>
  382. <dl>
  383. <dt><span class="paramLabel">Parameters:</span></dt>
  384. <dd><code>innerName</code> - one of the two Strings needed to retrieve this later</dd>
  385. <dd><code>o</code> - the Object to prepare to store</dd>
  386. <dt><span class="returnLabel">Returns:</span></dt>
  387. <dd>this for chaining</dd>
  388. </dl>
  389. </li>
  390. </ul>
  391. <a name="store-java.lang.String-">
  392. <!-- -->
  393. </a>
  394. <ul class="blockList">
  395. <li class="blockList">
  396. <h4>store</h4>
  397. <pre>public&nbsp;<a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a>&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.353">store</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;outerName)</pre>
  398. <div class="block">Actually stores all objects that had previously been prepared with <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>, with
  399. <code>outerName</code> used as a key to retrieve any object in the current group. Flushes the preferences, making the
  400. changes permanent (until overwritten), but does not change the current group (you may want to call this method
  401. again with additional items in the current group, and that would simply involve calling put() again). If you want
  402. to clear the current group, use <a href="../squidpony/SquidStorage.html#clear--"><code>clear()</code></a>. If you want to remove just one object from the current group,
  403. use <a href="../squidpony/SquidStorage.html#remove-java.lang.String-"><code>remove(String)</code></a>.</div>
  404. <dl>
  405. <dt><span class="paramLabel">Parameters:</span></dt>
  406. <dd><code>outerName</code> - one of the two Strings needed to retrieve any of the objects in the current group</dd>
  407. <dt><span class="returnLabel">Returns:</span></dt>
  408. <dd>this for chaining</dd>
  409. </dl>
  410. </li>
  411. </ul>
  412. <a name="show--">
  413. <!-- -->
  414. </a>
  415. <ul class="blockList">
  416. <li class="blockList">
  417. <h4>show</h4>
  418. <pre>public&nbsp;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.368">show</a>()</pre>
  419. <div class="block">Gets a String representation of the data that would be saved when <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> is called. This can be
  420. useful for finding particularly problematic objects that require unnecessary space when serialized.</div>
  421. <dl>
  422. <dt><span class="returnLabel">Returns:</span></dt>
  423. <dd>a String that previews what would be stored permanently when <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> is called</dd>
  424. </dl>
  425. </li>
  426. </ul>
  427. <a name="clear--">
  428. <!-- -->
  429. </a>
  430. <ul class="blockList">
  431. <li class="blockList">
  432. <h4>clear</h4>
  433. <pre>public&nbsp;<a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a>&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.380">clear</a>()</pre>
  434. <div class="block">Clears the current group of objects; recommended if you intend to store under multiple outerName keys.</div>
  435. <dl>
  436. <dt><span class="returnLabel">Returns:</span></dt>
  437. <dd>this for chaining</dd>
  438. </dl>
  439. </li>
  440. </ul>
  441. <a name="remove-java.lang.String-">
  442. <!-- -->
  443. </a>
  444. <ul class="blockList">
  445. <li class="blockList">
  446. <h4>remove</h4>
  447. <pre>public&nbsp;<a href="../squidpony/SquidStorage.html" title="class in squidpony">SquidStorage</a>&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.393">remove</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName)</pre>
  448. <div class="block">Removes one object from the current group by the <code>innerName</code> it was prepared with using
  449. <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>. This does not affect already-stored objects unless <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> is called
  450. after this, in which case the new version of the current group, without the object this removed, is stored.</div>
  451. <dl>
  452. <dt><span class="paramLabel">Parameters:</span></dt>
  453. <dd><code>innerName</code> - the String key used to put an object in the current group with <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a></dd>
  454. <dt><span class="returnLabel">Returns:</span></dt>
  455. <dd>this for chaining</dd>
  456. </dl>
  457. </li>
  458. </ul>
  459. <a name="get-java.lang.String-java.lang.String-java.lang.Class-">
  460. <!-- -->
  461. </a>
  462. <ul class="blockList">
  463. <li class="blockList">
  464. <h4>get</h4>
  465. <pre>public&nbsp;&lt;T&gt;&nbsp;T&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.411">get</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;outerName,
  466. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;innerName,
  467. <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;type)</pre>
  468. <div class="block">Gets an object from the storage by the given <code>outerName</code> key from <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a> and
  469. <code>innerName</code> key from <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>, and uses the class given by <code>type</code> for the
  470. returned value, assuming it matches the object that was originally put with those keys. If no such object is
  471. present, returns null. Results are undefined if <code>type</code> doesn't match the actual class of the stored object.</div>
  472. <dl>
  473. <dt><span class="paramLabel">Type Parameters:</span></dt>
  474. <dd><code>T</code> - the type of the value to retrieve; if type was <code>RNG.class</code>, this would be <code>RNG</code></dd>
  475. <dt><span class="paramLabel">Parameters:</span></dt>
  476. <dd><code>outerName</code> - the key used to store the group of objects with <a href="../squidpony/SquidStorage.html#store-java.lang.String-"><code>store(String)</code></a></dd>
  477. <dd><code>innerName</code> - the key used to store the specific object with <a href="../squidpony/SquidStorage.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a></dd>
  478. <dd><code>type</code> - the class of the value; for a class like RNG, use <code>RNG.class</code>, but changed to fit</dd>
  479. <dt><span class="returnLabel">Returns:</span></dt>
  480. <dd>the retrieved value if successful, or null otherwise</dd>
  481. </dl>
  482. </li>
  483. </ul>
  484. <a name="preferencesSize--">
  485. <!-- -->
  486. </a>
  487. <ul class="blockListLast">
  488. <li class="blockList">
  489. <h4>preferencesSize</h4>
  490. <pre>public&nbsp;int&nbsp;<a href="../src-html/squidpony/SquidStorage.html#line.432">preferencesSize</a>()</pre>
  491. <div class="block">Gets the approximate size of the currently-stored preferences. This assumes UTF-16 storage, which is the case for
  492. GWT's LocalStorage. Since GWT is restricted to the size the browser permits for LocalStorage, and this limit can
  493. be rather small (about 5 MB, sometimes more but not reliably), this method is especially useful there, but it may
  494. yield inaccurate sizes on other platforms that save Preferences data differently.</div>
  495. <dl>
  496. <dt><span class="returnLabel">Returns:</span></dt>
  497. <dd>the size, in bytes, of the already-stored preferences</dd>
  498. </dl>
  499. </li>
  500. </ul>
  501. </li>
  502. </ul>
  503. </li>
  504. </ul>
  505. </div>
  506. </div>
  507. <!-- ========= END OF CLASS DATA ========= -->
  508. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  509. <div class="bottomNav"><a name="navbar.bottom">
  510. <!-- -->
  511. </a>
  512. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  513. <a name="navbar.bottom.firstrow">
  514. <!-- -->
  515. </a>
  516. <ul class="navList" title="Navigation">
  517. <li><a href="../squidpony/package-summary.html">Package</a></li>
  518. <li class="navBarCell1Rev">Class</li>
  519. <li><a href="class-use/SquidStorage.html">Use</a></li>
  520. <li><a href="package-tree.html">Tree</a></li>
  521. <li><a href="../deprecated-list.html">Deprecated</a></li>
  522. <li><a href="../index-files/index-1.html">Index</a></li>
  523. <li><a href="../help-doc.html">Help</a></li>
  524. </ul>
  525. </div>
  526. <div class="subNav">
  527. <ul class="navList">
  528. <li>Prev&nbsp;Class</li>
  529. <li>Next&nbsp;Class</li>
  530. </ul>
  531. <ul class="navList">
  532. <li><a href="../index.html?squidpony/SquidStorage.html" target="_top">Frames</a></li>
  533. <li><a href="SquidStorage.html" target="_top">No&nbsp;Frames</a></li>
  534. </ul>
  535. <ul class="navList" id="allclasses_navbar_bottom">
  536. <li><a href="../allclasses-noframe.html">All&nbsp;Classes</a></li>
  537. </ul>
  538. <div>
  539. <script type="text/javascript"><!--
  540. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  541. if(window==top) {
  542. allClassesLink.style.display = "block";
  543. }
  544. else {
  545. allClassesLink.style.display = "none";
  546. }
  547. //-->
  548. </script>
  549. </div>
  550. <div>
  551. <ul class="subNavList">
  552. <li>Summary:&nbsp;</li>
  553. <li>Nested&nbsp;|&nbsp;</li>
  554. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  555. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  556. <li><a href="#method.summary">Method</a></li>
  557. </ul>
  558. <ul class="subNavList">
  559. <li>Detail:&nbsp;</li>
  560. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  561. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  562. <li><a href="#method.detail">Method</a></li>
  563. </ul>
  564. </div>
  565. <a name="skip.navbar.bottom">
  566. <!-- -->
  567. </a></div>
  568. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  569. <p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2016. All rights reserved.</small></p>
  570. </body>
  571. </html>