744 lines
		
	
	
		
			29 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			744 lines
		
	
	
		
			29 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 | |
| <!-- NewPage -->
 | |
| <html lang="fr">
 | |
| <head>
 | |
| <!-- Generated by javadoc (1.8.0_271) on Tue Apr 13 09:36:01 CEST 2021 -->
 | |
| <title>Utility</title>
 | |
| <meta name="date" content="2021-04-13">
 | |
| <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="Utility";
 | |
|         }
 | |
|     }
 | |
|     catch(err) {
 | |
|     }
 | |
| //-->
 | |
| var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9};
 | |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static 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="../../../../ch/hevs/isi/utils/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-files/index-1.html">Index</a></li>
 | |
| <li><a href="../../../../help-doc.html">Help</a></li>
 | |
| </ul>
 | |
| </div>
 | |
| <div class="subNav">
 | |
| <ul class="navList">
 | |
| <li>Prev Class</li>
 | |
| <li>Next Class</li>
 | |
| </ul>
 | |
| <ul class="navList">
 | |
| <li><a href="../../../../index.html?ch/hevs/isi/utils/Utility.html" target="_top">Frames</a></li>
 | |
| <li><a href="Utility.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><a href="#field.summary">Field</a> | </li>
 | |
| <li><a href="#constructor.summary">Constr</a> | </li>
 | |
| <li><a href="#method.summary">Method</a></li>
 | |
| </ul>
 | |
| <ul class="subNavList">
 | |
| <li>Detail: </li>
 | |
| <li><a href="#field.detail">Field</a> | </li>
 | |
| <li><a href="#constructor.detail">Constr</a> | </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">ch.hevs.isi.utils</div>
 | |
| <h2 title="Class Utility" class="title">Class Utility</h2>
 | |
| </div>
 | |
| <div class="contentContainer">
 | |
| <ul class="inheritance">
 | |
| <li>java.lang.Object</li>
 | |
| <li>
 | |
| <ul class="inheritance">
 | |
| <li>ch.hevs.isi.utils.Utility</li>
 | |
| </ul>
 | |
| </li>
 | |
| </ul>
 | |
| <div class="description">
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <hr>
 | |
| <br>
 | |
| <pre>public class <span class="typeNameLabel">Utility</span>
 | |
| extends java.lang.Object</pre>
 | |
| <div class="block">This class contains some useful Java methods to manipulate data.</div>
 | |
| </li>
 | |
| </ul>
 | |
| </div>
 | |
| <div class="summary">
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <!-- =========== FIELD SUMMARY =========== -->
 | |
| <ul class="blockList">
 | |
| <li class="blockList"><a name="field.summary">
 | |
| <!--   -->
 | |
| </a>
 | |
| <h3>Field Summary</h3>
 | |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
 | |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption>
 | |
| <tr>
 | |
| <th class="colFirst" scope="col">Modifier and Type</th>
 | |
| <th class="colLast" scope="col">Field and Description</th>
 | |
| </tr>
 | |
| <tr class="altColor">
 | |
| <td class="colFirst"><code>static java.util.Random</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#rnd">rnd</a></span></code>
 | |
| <div class="block">Object to get some random values...</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr class="rowColor">
 | |
| <td class="colFirst"><code>static int</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#TCP_BUFFER_SIZE">TCP_BUFFER_SIZE</a></span></code>
 | |
| <div class="block">Default size for the TCP input stream</div>
 | |
| </td>
 | |
| </tr>
 | |
| </table>
 | |
| </li>
 | |
| </ul>
 | |
| <!-- ======== CONSTRUCTOR SUMMARY ======== -->
 | |
| <ul class="blockList">
 | |
| <li class="blockList"><a name="constructor.summary">
 | |
| <!--   -->
 | |
| </a>
 | |
| <h3>Constructor Summary</h3>
 | |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
 | |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
 | |
| <tr>
 | |
| <th class="colOne" scope="col">Constructor and Description</th>
 | |
| </tr>
 | |
| <tr class="altColor">
 | |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#Utility--">Utility</a></span>()</code> </td>
 | |
| </tr>
 | |
| </table>
 | |
| </li>
 | |
| </ul>
 | |
| <!-- ========== 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="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>static java.lang.Float</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#bytesToFloat-byte:A-int-int-">bytesToFloat</a></span>(byte[] bytes,
 | |
|             int offset,
 | |
|             int size)</code>
 | |
| <div class="block">Returns a <code>float</code> value from array of bytes.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i1" class="rowColor">
 | |
| <td class="colFirst"><code>static byte[]</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#calculateCRC-byte:A-int-int-">calculateCRC</a></span>(byte[] data,
 | |
|             int offset,
 | |
|             int len)</code>
 | |
| <div class="block">Calculates and returns the CRC using the data passed in parameters.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i2" class="altColor">
 | |
| <td class="colFirst"><code>static boolean</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#checkCRC-byte:A-int-int-byte:A-">checkCRC</a></span>(byte[] data,
 | |
|         int offset,
 | |
|         int len,
 | |
|         byte[] crc)</code>
 | |
| <div class="block">Checks the CRC and returns true if it is correct, otherwise false.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i3" class="rowColor">
 | |
| <td class="colFirst"><code>static void</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#DEBUG-java.lang.String-java.lang.String-java.lang.String-">DEBUG</a></span>(java.lang.String className,
 | |
|      java.lang.String method,
 | |
|      java.lang.String msg)</code> </td>
 | |
| </tr>
 | |
| <tr id="i4" class="altColor">
 | |
| <td class="colFirst"><code>static java.io.BufferedReader</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#fileParser-java.lang.String-java.lang.String-">fileParser</a></span>(java.lang.String path,
 | |
|           java.lang.String fileName)</code>
 | |
| <div class="block">Method to use to access a file in your resources folder...</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i5" class="rowColor">
 | |
| <td class="colFirst"><code>static java.lang.String</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#getHexString-byte:A-">getHexString</a></span>(byte[] b)</code>
 | |
| <div class="block">Utility method to convert a byte array in a string made up of hex (0,.. 9, a,..f).</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i6" class="altColor">
 | |
| <td class="colFirst"><code>static java.lang.String</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#getHexString-byte:A-int-int-">getHexString</a></span>(byte[] b,
 | |
|             int offset,
 | |
|             int length)</code>
 | |
| <div class="block">Utility method to convert a byte array in a string made up of hex (0,.. 9, a,..f)</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i7" class="rowColor">
 | |
| <td class="colFirst"><code>static java.lang.String</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#getStringRndVal-int-">getStringRndVal</a></span>(int factor)</code>
 | |
| <div class="block">Retrieves a random value rounded to 2 decimal...</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i8" class="altColor">
 | |
| <td class="colFirst"><code>static java.lang.String</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#md5sum-java.lang.String-">md5sum</a></span>(java.lang.String msg)</code>
 | |
| <div class="block">Returns the md5 of any input...</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i9" class="rowColor">
 | |
| <td class="colFirst"><code>static byte[]</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#readBytes-java.io.InputStream-">readBytes</a></span>(java.io.InputStream in)</code>
 | |
| <div class="block">Reads the incoming data from an input stream as long as there is something to read and saved the data in an array
 | |
|  of bytes.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i10" class="altColor">
 | |
| <td class="colFirst"><code>static byte[]</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#readLine-java.io.InputStream-">readLine</a></span>(java.io.InputStream in)</code>
 | |
| <div class="block">Reads a line of text.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i11" class="rowColor">
 | |
| <td class="colFirst"><code>static byte[]</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#readNBytes-java.io.InputStream-int-">readNBytes</a></span>(java.io.InputStream in,
 | |
|           int len)</code>
 | |
| <div class="block">Reads from the given input stream an amount of bytes and retrieves these data as an array of bytes.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i12" class="altColor">
 | |
| <td class="colFirst"><code>static void</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#sendBytes-java.io.OutputStream-byte:A-int-int-">sendBytes</a></span>(java.io.OutputStream out,
 | |
|          byte[] toSend,
 | |
|          int offset,
 | |
|          int length)</code>
 | |
| <div class="block">This method sends the content of the <code>buffer</code> to the given <code>OutputStream</code>.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i13" class="rowColor">
 | |
| <td class="colFirst"><code>static int</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#unsignedByteToSignedInt-byte-">unsignedByteToSignedInt</a></span>(byte from)</code>
 | |
| <div class="block">Converts an unsigned byte to a signed integer.</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i14" class="altColor">
 | |
| <td class="colFirst"><code>static void</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#waitSomeTime-int-">waitSomeTime</a></span>(int ms)</code>
 | |
| <div class="block">To wait some times ...</div>
 | |
| </td>
 | |
| </tr>
 | |
| <tr id="i15" class="rowColor">
 | |
| <td class="colFirst"><code>static void</code></td>
 | |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../ch/hevs/isi/utils/Utility.html#writeLine-java.io.OutputStream-byte:A-">writeLine</a></span>(java.io.OutputStream out,
 | |
|          byte[] toSend)</code>
 | |
| <div class="block">Send the data contained in the given array of bytes through the output
 | |
|  stream.</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">
 | |
| <!-- ============ FIELD DETAIL =========== -->
 | |
| <ul class="blockList">
 | |
| <li class="blockList"><a name="field.detail">
 | |
| <!--   -->
 | |
| </a>
 | |
| <h3>Field Detail</h3>
 | |
| <a name="TCP_BUFFER_SIZE">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>TCP_BUFFER_SIZE</h4>
 | |
| <pre>public static final int TCP_BUFFER_SIZE</pre>
 | |
| <div class="block">Default size for the TCP input stream</div>
 | |
| <dl>
 | |
| <dt><span class="seeLabel">See Also:</span></dt>
 | |
| <dd><a href="../../../../constant-values.html#ch.hevs.isi.utils.Utility.TCP_BUFFER_SIZE">Constant Field Values</a></dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="rnd">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockListLast">
 | |
| <li class="blockList">
 | |
| <h4>rnd</h4>
 | |
| <pre>public static java.util.Random rnd</pre>
 | |
| <div class="block">Object to get some random values...</div>
 | |
| </li>
 | |
| </ul>
 | |
| </li>
 | |
| </ul>
 | |
| <!-- ========= CONSTRUCTOR DETAIL ======== -->
 | |
| <ul class="blockList">
 | |
| <li class="blockList"><a name="constructor.detail">
 | |
| <!--   -->
 | |
| </a>
 | |
| <h3>Constructor Detail</h3>
 | |
| <a name="Utility--">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockListLast">
 | |
| <li class="blockList">
 | |
| <h4>Utility</h4>
 | |
| <pre>public Utility()</pre>
 | |
| </li>
 | |
| </ul>
 | |
| </li>
 | |
| </ul>
 | |
| <!-- ============ METHOD DETAIL ========== -->
 | |
| <ul class="blockList">
 | |
| <li class="blockList"><a name="method.detail">
 | |
| <!--   -->
 | |
| </a>
 | |
| <h3>Method Detail</h3>
 | |
| <a name="calculateCRC-byte:A-int-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>calculateCRC</h4>
 | |
| <pre>public static byte[] calculateCRC(byte[] data,
 | |
|                                   int offset,
 | |
|                                   int len)</pre>
 | |
| <div class="block">Calculates and returns the CRC using the data passed in parameters.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>data</code> - a byte array containing the data to send</dd>
 | |
| <dd><code>offset</code> - the offset</dd>
 | |
| <dd><code>len</code> - the data length</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>byte[] the CRC</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="checkCRC-byte:A-int-int-byte:A-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>checkCRC</h4>
 | |
| <pre>public static boolean checkCRC(byte[] data,
 | |
|                                int offset,
 | |
|                                int len,
 | |
|                                byte[] crc)</pre>
 | |
| <div class="block">Checks the CRC and returns true if it is correct, otherwise false.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>data</code> - a byte array containing the data to send</dd>
 | |
| <dd><code>offset</code> - the offset</dd>
 | |
| <dd><code>len</code> - the data length</dd>
 | |
| <dd><code>crc</code> - a byte array containing the CRC to check</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>boolean true if the CRC is correct, otherwise false</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="unsignedByteToSignedInt-byte-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>unsignedByteToSignedInt</h4>
 | |
| <pre>public static int unsignedByteToSignedInt(byte from)</pre>
 | |
| <div class="block">Converts an unsigned byte to a signed integer.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>from</code> - an unsigned byte to convert to a signed integer</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>int a signed integer</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="getHexString-byte:A-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>getHexString</h4>
 | |
| <pre>public static java.lang.String getHexString(byte[] b)</pre>
 | |
| <div class="block">Utility method to convert a byte array in a string made up of hex (0,.. 9, a,..f). The array of bytes is 
 | |
|  converted from offset 0 to its end.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>b</code> - Array of bytes to be converted in HEX string.</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>A String representing the HEX values of the given array of bytes.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="getHexString-byte:A-int-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>getHexString</h4>
 | |
| <pre>public static java.lang.String getHexString(byte[] b,
 | |
|                                             int offset,
 | |
|                                             int length)</pre>
 | |
| <div class="block">Utility method to convert a byte array in a string made up of hex (0,.. 9, a,..f)</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>b</code> - The byte array to convert in HEX string</dd>
 | |
| <dd><code>offset</code> - The index where we start to convert from.</dd>
 | |
| <dd><code>length</code> - The amount of bytes to convert in HEX string</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>A String representing the HEX values of the selected bytes of the array.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="getStringRndVal-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>getStringRndVal</h4>
 | |
| <pre>public static java.lang.String getStringRndVal(int factor)</pre>
 | |
| <div class="block">Retrieves a random value rounded to 2 decimal...</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>factor</code> - A coefficient which the random value is multiplied with.</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>A random value rounded to 2 decimal converted to a String.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="readBytes-java.io.InputStream-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>readBytes</h4>
 | |
| <pre>public static byte[] readBytes(java.io.InputStream in)
 | |
|                         throws java.io.IOException</pre>
 | |
| <div class="block">Reads the incoming data from an input stream as long as there is something to read and saved the data in an array
 | |
|  of bytes.
 | |
| 
 | |
|  The method is blocking ! This method blocks until input data is available, end of file is detected, or an 
 | |
|  exception is thrown.
 | |
| 
 | |
|  If the length of of read data is zero, then no bytes are read and an empty array of bytes is returned; otherwise,
 | |
|  there is an attempt to read at least one byte. If no byte is available because the stream is at the end of the
 | |
|  file, the value -1 is returned; otherwise, at least one byte is read and returned as an array of bytes.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>in</code> - The input Stream where to read the data coming from.</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>The read data as an <code>array of bytes</code>. Or null if the has been closed by the peer while
 | |
|           waiting for incoming data.</dd>
 | |
| <dt><span class="throwsLabel">Throws:</span></dt>
 | |
| <dd><code>java.io.IOException</code> - If the first byte cannot be read for any reason other than the end of the file, if the input
 | |
|                       stream has been closed, or if some other I/O error occurs.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="readNBytes-java.io.InputStream-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>readNBytes</h4>
 | |
| <pre>public static byte[] readNBytes(java.io.InputStream in,
 | |
|                                 int len)
 | |
|                          throws java.io.IOException</pre>
 | |
| <div class="block">Reads from the given input stream an amount of bytes and retrieves these data as an array of bytes.
 | |
| 
 | |
|  The method is blocking !</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>in</code> - The input stream where to read the data coming from.</dd>
 | |
| <dd><code>len</code> - The amount of data to read</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>The read data as an <code>array of bytes</code>.</dd>
 | |
| <dt><span class="throwsLabel">Throws:</span></dt>
 | |
| <dd><code>java.io.IOException</code> - If the first byte cannot be read for any reason other
 | |
|                       than the end of the file, if the input stream has been
 | |
|                       closed, or if some other I/O error occurs.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="readLine-java.io.InputStream-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>readLine</h4>
 | |
| <pre>public static byte[] readLine(java.io.InputStream in)
 | |
|                        throws java.io.IOException</pre>
 | |
| <div class="block">Reads a line of text. A line is considered to be terminated by any one of a
 | |
|  line feed ('\n'), a carriage return ('\r'), or a carriage return followed
 | |
|  immediately by a line feed.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>in</code> - The Input Stream to read from.</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>An array of bytes containing the contents of the line, not including any
 | |
|             line-termination characters, or null if the end of the stream has
 | |
|          been reached.</dd>
 | |
| <dt><span class="throwsLabel">Throws:</span></dt>
 | |
| <dd><code>java.io.IOException</code> - If an I/O error occurs</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="writeLine-java.io.OutputStream-byte:A-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>writeLine</h4>
 | |
| <pre>public static void writeLine(java.io.OutputStream out,
 | |
|                              byte[] toSend)
 | |
|                       throws java.io.IOException</pre>
 | |
| <div class="block">Send the data contained in the given array of bytes through the output
 | |
|  stream. If the data to send do not end with a carriage return, the method adds '\r\n' at the end.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>out</code> - The Output Stream to send the data to.</dd>
 | |
| <dd><code>toSend</code> - The data to send</dd>
 | |
| <dt><span class="throwsLabel">Throws:</span></dt>
 | |
| <dd><code>java.io.IOException</code> - If an I/O error occurs</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="sendBytes-java.io.OutputStream-byte:A-int-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>sendBytes</h4>
 | |
| <pre>public static void sendBytes(java.io.OutputStream out,
 | |
|                              byte[] toSend,
 | |
|                              int offset,
 | |
|                              int length)
 | |
|                       throws java.io.IOException</pre>
 | |
| <div class="block">This method sends the content of the <code>buffer</code> to the given <code>OutputStream</code>. This content is
 | |
|  specified by the starting position, defined by <code>offset</code>, and the amount of bytes,defined by
 | |
|  <code>length</code>. If an error occurs during this process, a exception will be raised.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>out</code> - The Output Stream to send the data to.</dd>
 | |
| <dd><code>toSend</code> - The data to send</dd>
 | |
| <dd><code>offset</code> - The starting position in the buffer of data</dd>
 | |
| <dd><code>length</code> - The amount of bytes to be sent.</dd>
 | |
| <dt><span class="throwsLabel">Throws:</span></dt>
 | |
| <dd><code>java.io.IOException</code> - If an I/O error occurs</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="waitSomeTime-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>waitSomeTime</h4>
 | |
| <pre>public static void waitSomeTime(int ms)</pre>
 | |
| <div class="block">To wait some times ... Simply give the delay you want to wait for and that's it !</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>ms</code> - The amount of time to wait expressed in milli-seconds [ms].</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="md5sum-java.lang.String-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>md5sum</h4>
 | |
| <pre>public static java.lang.String md5sum(java.lang.String msg)</pre>
 | |
| <div class="block">Returns the md5 of any input...</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>msg</code> - The input string to process</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>The md5 of the input string.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="bytesToFloat-byte:A-int-int-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>bytesToFloat</h4>
 | |
| <pre>public static java.lang.Float bytesToFloat(byte[] bytes,
 | |
|                                            int offset,
 | |
|                                            int size)</pre>
 | |
| <div class="block">Returns a <code>float</code> value from array of bytes. This byte's array can only be 2 or 4 bytes long.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>bytes</code> - The array of bytes to convert.</dd>
 | |
| <dd><code>offset</code> - The position where the method has to start to get the bytes from.</dd>
 | |
| <dd><code>size</code> - The amount of bytes to convert.</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>A <code>Float</code> value or <code>null</code> if the process failed.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="fileParser-java.lang.String-java.lang.String-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockList">
 | |
| <li class="blockList">
 | |
| <h4>fileParser</h4>
 | |
| <pre>public static java.io.BufferedReader fileParser(java.lang.String path,
 | |
|                                                 java.lang.String fileName)</pre>
 | |
| <div class="block">Method to use to access a file in your resources folder... The file you want to access has to be under the
 | |
|  `resources` folder of your project. You can create as many sub-folders as you want, they will become the path of
 | |
|  the file to work with. This path is given to the method by the parameter `path` and the file is identified by its
 | |
|  name and extension.</div>
 | |
| <dl>
 | |
| <dt><span class="paramLabel">Parameters:</span></dt>
 | |
| <dd><code>path</code> - folder's hierarchy (if exists) from `resources`</dd>
 | |
| <dd><code>fileName</code> - Name of the file to access</dd>
 | |
| <dt><span class="returnLabel">Returns:</span></dt>
 | |
| <dd>A <code>BufferedReader</code> related to the file you want to work with, or null if the file could not
 | |
|           be reached.</dd>
 | |
| </dl>
 | |
| </li>
 | |
| </ul>
 | |
| <a name="DEBUG-java.lang.String-java.lang.String-java.lang.String-">
 | |
| <!--   -->
 | |
| </a>
 | |
| <ul class="blockListLast">
 | |
| <li class="blockList">
 | |
| <h4>DEBUG</h4>
 | |
| <pre>public static void DEBUG(java.lang.String className,
 | |
|                          java.lang.String method,
 | |
|                          java.lang.String msg)</pre>
 | |
| </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="../../../../ch/hevs/isi/utils/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-files/index-1.html">Index</a></li>
 | |
| <li><a href="../../../../help-doc.html">Help</a></li>
 | |
| </ul>
 | |
| </div>
 | |
| <div class="subNav">
 | |
| <ul class="navList">
 | |
| <li>Prev Class</li>
 | |
| <li>Next Class</li>
 | |
| </ul>
 | |
| <ul class="navList">
 | |
| <li><a href="../../../../index.html?ch/hevs/isi/utils/Utility.html" target="_top">Frames</a></li>
 | |
| <li><a href="Utility.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><a href="#field.summary">Field</a> | </li>
 | |
| <li><a href="#constructor.summary">Constr</a> | </li>
 | |
| <li><a href="#method.summary">Method</a></li>
 | |
| </ul>
 | |
| <ul class="subNavList">
 | |
| <li>Detail: </li>
 | |
| <li><a href="#field.detail">Field</a> | </li>
 | |
| <li><a href="#constructor.detail">Constr</a> | </li>
 | |
| <li><a href="#method.detail">Method</a></li>
 | |
| </ul>
 | |
| </div>
 | |
| <a name="skip.navbar.bottom">
 | |
| <!--   -->
 | |
| </a></div>
 | |
| <!-- ======== END OF BOTTOM NAVBAR ======= -->
 | |
| </body>
 | |
| </html>
 |