You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Projet_JAVA_P2P_STRI2A/doc/javadoc/protocolP2P/Payload.html

499 lines
20 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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_181) on Mon Apr 13 15:38:51 CEST 2020 -->
<title>Payload</title>
<meta name="date" content="2020-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="Payload";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":9,"i2":10,"i3":9,"i4":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="class-use/Payload.html">Use</a></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><a href="../protocolP2P/LoadRequest.html" title="class in protocolP2P"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../protocolP2P/ProtocolP2PPacket.html" title="class in protocolP2P"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?protocolP2P/Payload.html" target="_top">Frames</a></li>
<li><a href="Payload.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</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">protocolP2P</div>
<h2 title="Class Payload" class="title">Class Payload</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>protocolP2P.Payload</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../protocolP2P/Denied.html" title="class in protocolP2P">Denied</a>, <a href="../protocolP2P/DiscoverRequest.html" title="class in protocolP2P">DiscoverRequest</a>, <a href="../protocolP2P/DiscoverResponse.html" title="class in protocolP2P">DiscoverResponse</a>, <a href="../protocolP2P/FileList.html" title="class in protocolP2P">FileList</a>, <a href="../protocolP2P/FilePart.html" title="class in protocolP2P">FilePart</a>, <a href="../protocolP2P/HashRequest.html" title="class in protocolP2P">HashRequest</a>, <a href="../protocolP2P/HashResponse.html" title="class in protocolP2P">HashResponse</a>, <a href="../protocolP2P/LoadRequest.html" title="class in protocolP2P">LoadRequest</a>, <a href="../protocolP2P/RatioRequest.html" title="class in protocolP2P">RatioRequest</a>, <a href="../protocolP2P/RatioResponse.html" title="class in protocolP2P">RatioResponse</a>, <a href="../protocolP2P/Register.html" title="class in protocolP2P">Register</a>, <a href="../protocolP2P/SizeRequest.html" title="class in protocolP2P">SizeRequest</a>, <a href="../protocolP2P/SizeResponse.html" title="class in protocolP2P">SizeResponse</a>, <a href="../protocolP2P/Unregister.html" title="class in protocolP2P">Unregister</a>, <a href="../protocolP2P/UpdateRatio.html" title="class in protocolP2P">UpdateRatio</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">Payload</span>
extends java.lang.Object</pre>
<div class="block">Representation of payload. If payload has a size, use subclasses instead.</div>
<dl>
<dt><span class="simpleTagLabel">Version:</span></dt>
<dd>1.0</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Louis Royer, Flavien Haas, JS Auge</dd>
</dl>
</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">&nbsp;</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>protected static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#PAYLOAD_SIZE_POSITION">PAYLOAD_SIZE_POSITION</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#PAYLOAD_START_POSITION">PAYLOAD_START_POSITION</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#requestResponseCode">requestResponseCode</a></span></code>&nbsp;</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">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#Payload-byte:A-">Payload</a></span>(byte[]&nbsp;packet)</code>
<div class="block">Constructor used to create a Payload (when no more specific subclasses exists) using packet as parameter.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#Payload-protocolP2P.RequestResponseCode-">Payload</a></span>(<a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a>&nbsp;requestResponseCode)</code>
<div class="block">Consructor used to create Payload with a payload size of zero using a RRCode.</div>
</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">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></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>
<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>private void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#checkRequestResponseCode--">checkRequestResponseCode</a></span>()</code>
<div class="block">Used to check RRCode used is compatible with this class use, or if a more specific subclass is required.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#getPayloadSize-byte:A-">getPayloadSize</a></span>(byte[]&nbsp;packet)</code>
<div class="block">Get payloads size from a Packet.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#getRequestResponseCode--">getRequestResponseCode</a></span>()</code>
<div class="block">RRCode getter.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#setPayloadSize-int-byte:A-">setPayloadSize</a></span>(int&nbsp;size,
byte[]&nbsp;packet)</code>
<div class="block">Set payloads size in a Packet.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>protected byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../protocolP2P/Payload.html#toPacket--">toPacket</a></span>()</code>
<div class="block">Returns a byte[] containing Packet with padding.</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&nbsp;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="requestResponseCode">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>requestResponseCode</h4>
<pre>protected&nbsp;<a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a> requestResponseCode</pre>
</li>
</ul>
<a name="PAYLOAD_SIZE_POSITION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PAYLOAD_SIZE_POSITION</h4>
<pre>protected static final&nbsp;int PAYLOAD_SIZE_POSITION</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../constant-values.html#protocolP2P.Payload.PAYLOAD_SIZE_POSITION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="PAYLOAD_START_POSITION">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>PAYLOAD_START_POSITION</h4>
<pre>protected static final&nbsp;int PAYLOAD_START_POSITION</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../constant-values.html#protocolP2P.Payload.PAYLOAD_START_POSITION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Payload-protocolP2P.RequestResponseCode-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Payload</h4>
<pre>public&nbsp;Payload(<a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a>&nbsp;requestResponseCode)
throws <a href="../localException/InternalError.html" title="class in localException">InternalError</a></pre>
<div class="block">Consructor used to create Payload with a payload size of zero using a RRCode.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>requestResponseCode</code> - Request/Response code associated with the payload</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/InternalError.html" title="class in localException">InternalError</a></code></dd>
</dl>
</li>
</ul>
<a name="Payload-byte:A-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Payload</h4>
<pre>protected&nbsp;Payload(byte[]&nbsp;packet)
throws <a href="../localException/SizeError.html" title="class in localException">SizeError</a>,
<a href="../localException/ProtocolError.html" title="class in localException">ProtocolError</a>,
<a href="../localException/InternalError.html" title="class in localException">InternalError</a>,
<a href="../localException/TransmissionError.html" title="class in localException">TransmissionError</a></pre>
<div class="block">Constructor used to create a Payload (when no more specific subclasses exists) using packet as parameter.
If payload size is not empty, using subclass is required.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>packet</code> - the full packet received</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/ProtocolError.html" title="class in localException">ProtocolError</a></code></dd>
<dd><code><a href="../localException/InternalError.html" title="class in localException">InternalError</a></code></dd>
<dd><code><a href="../localException/TransmissionError.html" title="class in localException">TransmissionError</a></code></dd>
<dd><code><a href="../localException/SizeError.html" title="class in localException">SizeError</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="checkRequestResponseCode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkRequestResponseCode</h4>
<pre>private&nbsp;void&nbsp;checkRequestResponseCode()
throws <a href="../localException/InternalError.html" title="class in localException">InternalError</a></pre>
<div class="block">Used to check RRCode used is compatible with this class use, or if a more specific subclass is required.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/InternalError.html" title="class in localException">InternalError</a></code></dd>
</dl>
</li>
</ul>
<a name="toPacket--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toPacket</h4>
<pre>protected&nbsp;byte[]&nbsp;toPacket()
throws <a href="../localException/InternalError.html" title="class in localException">InternalError</a></pre>
<div class="block">Returns a byte[] containing Packet with padding.
This Packet is still incomplete and should not be send directly.
ProtocolP2PPacket will use this method to generate the complete Packet.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Packet with padding</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/InternalError.html" title="class in localException">InternalError</a></code></dd>
</dl>
</li>
</ul>
<a name="setPayloadSize-int-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPayloadSize</h4>
<pre>protected static&nbsp;void&nbsp;setPayloadSize(int&nbsp;size,
byte[]&nbsp;packet)
throws <a href="../localException/InternalError.html" title="class in localException">InternalError</a></pre>
<div class="block">Set payloads size in a Packet.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>size</code> - integer representing payload size</dd>
<dd><code>packet</code> - Packet to be completed</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/InternalError.html" title="class in localException">InternalError</a></code></dd>
</dl>
</li>
</ul>
<a name="getPayloadSize-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPayloadSize</h4>
<pre>protected static&nbsp;int&nbsp;getPayloadSize(byte[]&nbsp;packet)
throws <a href="../localException/SizeError.html" title="class in localException">SizeError</a></pre>
<div class="block">Get payloads size from a Packet.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>packet</code> - the full Packet received</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>integer representing payload size</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../localException/SizeError.html" title="class in localException">SizeError</a></code></dd>
</dl>
</li>
</ul>
<a name="getRequestResponseCode--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getRequestResponseCode</h4>
<pre>public&nbsp;<a href="../protocolP2P/RequestResponseCode.html" title="enum in protocolP2P">RequestResponseCode</a>&nbsp;getRequestResponseCode()</pre>
<div class="block">RRCode getter.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Request/Response code</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="class-use/Payload.html">Use</a></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><a href="../protocolP2P/LoadRequest.html" title="class in protocolP2P"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../protocolP2P/ProtocolP2PPacket.html" title="class in protocolP2P"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?protocolP2P/Payload.html" target="_top">Frames</a></li>
<li><a href="Payload.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>