wpilib18/java/current/javadoc/edu/wpi/first/wpilibj/Preferences.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Sat Oct 28 05:22:53 EDT 2017 -->
<title>Preferences (Documentation - Release API)</title>
<meta name="date" content="2017-10-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Preferences (Documentation - Release API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":9,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/PowerDistributionPanel.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/PWM.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Preferences.html" target="_top">Frames</a></li>
<li><a href="Preferences.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.wpi.first.wpilibj</div>
<h2 title="Class Preferences" class="title">Class Preferences</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>edu.wpi.first.wpilibj.Preferences</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Preferences</span>
extends java.lang.Object</pre>
<div class="block">The preferences class provides a relatively simple way to save important values to the roboRIO to
access the next time the roboRIO is booted.
<p> This class loads and saves from a file inside the roboRIO. The user can not access the file
directly, but may modify values at specific fields which will then be automatically saved to the
file by the NetworkTables server. </p>
<p> This class is thread safe. </p>
<p> This will also interact with <a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables"><code>NetworkTable</code></a> by creating a table called "Preferences"
with all the key-value pairs. </p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#containsKey-java.lang.String-">containsKey</a></span>(java.lang.String key)</code>
<div class="block">Returns whether or not there is a key with the given name.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getBoolean-java.lang.String-boolean-">getBoolean</a></span>(java.lang.String key,
boolean backup)</code>
<div class="block">Returns the boolean at the given key.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getDouble-java.lang.String-double-">getDouble</a></span>(java.lang.String key,
double backup)</code>
<div class="block">Returns the double at the given key.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>float</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getFloat-java.lang.String-float-">getFloat</a></span>(java.lang.String key,
float backup)</code>
<div class="block">Returns the float at the given key.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static <a href="../../../../edu/wpi/first/wpilibj/Preferences.html" title="class in edu.wpi.first.wpilibj">Preferences</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getInstance--">getInstance</a></span>()</code>
<div class="block">Returns the preferences instance.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getInt-java.lang.String-int-">getInt</a></span>(java.lang.String key,
int backup)</code>
<div class="block">Returns the int at the given key.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.util.Vector<java.lang.String></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getKeys--">getKeys</a></span>()</code>
<div class="block">Gets the vector of keys.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getLong-java.lang.String-long-">getLong</a></span>(java.lang.String key,
long backup)</code>
<div class="block">Returns the long at the given key.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#getString-java.lang.String-java.lang.String-">getString</a></span>(java.lang.String key,
java.lang.String backup)</code>
<div class="block">Returns the string at the given key.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putBoolean-java.lang.String-boolean-">putBoolean</a></span>(java.lang.String key,
boolean value)</code>
<div class="block">Puts the given boolean into the preferences table.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putDouble-java.lang.String-double-">putDouble</a></span>(java.lang.String key,
double value)</code>
<div class="block">Puts the given double into the preferences table.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putFloat-java.lang.String-float-">putFloat</a></span>(java.lang.String key,
float value)</code>
<div class="block">Puts the given float into the preferences table.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putInt-java.lang.String-int-">putInt</a></span>(java.lang.String key,
int value)</code>
<div class="block">Puts the given int into the preferences table.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putLong-java.lang.String-long-">putLong</a></span>(java.lang.String key,
long value)</code>
<div class="block">Puts the given long into the preferences table.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#putString-java.lang.String-java.lang.String-">putString</a></span>(java.lang.String key,
java.lang.String value)</code>
<div class="block">Puts the given string into the preferences table.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Preferences.html#remove-java.lang.String-">remove</a></span>(java.lang.String key)</code>
<div class="block">Remove a preference.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getInstance--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static <a href="../../../../edu/wpi/first/wpilibj/Preferences.html" title="class in edu.wpi.first.wpilibj">Preferences</a> getInstance()</pre>
<div class="block">Returns the preferences instance.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the preferences instance</dd>
</dl>
</li>
</ul>
<a name="getKeys--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getKeys</h4>
<pre>public java.util.Vector<java.lang.String> getKeys()</pre>
<div class="block">Gets the vector of keys.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a vector of the keys</dd>
</dl>
</li>
</ul>
<a name="putString-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putString</h4>
<pre>public void putString(java.lang.String key,
java.lang.String value)</pre>
<div class="block">Puts the given string into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if value is null</dd>
</dl>
</li>
</ul>
<a name="putInt-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putInt</h4>
<pre>public void putInt(java.lang.String key,
int value)</pre>
<div class="block">Puts the given int into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
</dl>
</li>
</ul>
<a name="putDouble-java.lang.String-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putDouble</h4>
<pre>public void putDouble(java.lang.String key,
double value)</pre>
<div class="block">Puts the given double into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
</dl>
</li>
</ul>
<a name="putFloat-java.lang.String-float-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putFloat</h4>
<pre>public void putFloat(java.lang.String key,
float value)</pre>
<div class="block">Puts the given float into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
</dl>
</li>
</ul>
<a name="putBoolean-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putBoolean</h4>
<pre>public void putBoolean(java.lang.String key,
boolean value)</pre>
<div class="block">Puts the given boolean into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
</dl>
</li>
</ul>
<a name="putLong-java.lang.String-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putLong</h4>
<pre>public void putLong(java.lang.String key,
long value)</pre>
<div class="block">Puts the given long into the preferences table.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>value</code> - the value</dd>
</dl>
</li>
</ul>
<a name="containsKey-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>containsKey</h4>
<pre>public boolean containsKey(java.lang.String key)</pre>
<div class="block">Returns whether or not there is a key with the given name.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if there is a value at the given key</dd>
</dl>
</li>
</ul>
<a name="remove-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public void remove(java.lang.String key)</pre>
<div class="block">Remove a preference.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
</dl>
</li>
</ul>
<a name="getString-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getString</h4>
<pre>public java.lang.String getString(java.lang.String key,
java.lang.String backup)</pre>
<div class="block">Returns the string at the given key. If this table does not have a value for that position,
then the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
<a name="getInt-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInt</h4>
<pre>public int getInt(java.lang.String key,
int backup)</pre>
<div class="block">Returns the int at the given key. If this table does not have a value for that position, then
the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
<a name="getDouble-java.lang.String-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDouble</h4>
<pre>public double getDouble(java.lang.String key,
double backup)</pre>
<div class="block">Returns the double at the given key. If this table does not have a value for that position,
then the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
<a name="getBoolean-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBoolean</h4>
<pre>public boolean getBoolean(java.lang.String key,
boolean backup)</pre>
<div class="block">Returns the boolean at the given key. If this table does not have a value for that position,
then the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
<a name="getFloat-java.lang.String-float-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFloat</h4>
<pre>public float getFloat(java.lang.String key,
float backup)</pre>
<div class="block">Returns the float at the given key. If this table does not have a value for that position, then
the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
<a name="getLong-java.lang.String-long-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getLong</h4>
<pre>public long getLong(java.lang.String key,
long backup)</pre>
<div class="block">Returns the long at the given key. If this table does not have a value for that position, then
the given backup value will be returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the key</dd>
<dd><code>backup</code> - the value to return if none exists in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>either the value in the table, or the backup</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/PowerDistributionPanel.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/PWM.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Preferences.html" target="_top">Frames</a></li>
<li><a href="Preferences.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>