aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
diff options
context:
space:
mode:
authorVlad Dumitrescu <[email protected]>2014-09-10 11:32:50 +0200
committerVlad Dumitrescu <[email protected]>2014-09-11 21:24:25 +0200
commitd0a1059d551c86d41ecbb36a1f23516eb71679c6 (patch)
tree0d09037d9e05c697a368e89a08e95166a30ec008 /lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
parent4725d4cc06ded1c9ee2712330e233aa865df3ebd (diff)
downloadotp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.tar.gz
otp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.tar.bz2
otp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.zip
keep all method parameters final
Diffstat (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
index 8d490d1370..a6e7936e78 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
@@ -85,16 +85,17 @@ public class OtpInputStream extends ByteArrayInputStream {
*
* @return the previous position in the stream.
*/
- public int setPos(int pos) {
+ public int setPos(final int pos) {
final int oldpos = super.pos;
+ int apos = pos;
if (pos > super.count) {
- pos = super.count;
+ apos = super.count;
} else if (pos < 0) {
- pos = 0;
+ apos = 0;
}
- super.pos = pos;
+ super.pos = apos;
return oldpos;
}
@@ -284,7 +285,7 @@ public class OtpInputStream extends ByteArrayInputStream {
* @exception OtpErlangDecodeException
* if the next byte cannot be read.
*/
- public long readLE(int n) throws OtpErlangDecodeException {
+ public long readLE(final int n) throws OtpErlangDecodeException {
final byte[] b = new byte[n];
try {
super.read(b);
@@ -292,8 +293,9 @@ public class OtpInputStream extends ByteArrayInputStream {
throw new OtpErlangDecodeException("Cannot read from input stream");
}
long v = 0;
- while (n-- > 0) {
- v = v << 8 | (long) b[n] & 0xff;
+ int i = n;
+ while (i-- > 0) {
+ v = v << 8 | (long) b[i] & 0xff;
}
return v;
}