You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2015/08/14 21:07:45 UTC
[12/50] [abbrv] qpid-proton git commit: Stubbed out the unimplemented
methods. Fixed formatting in ByteArrayDecoder
Stubbed out the unimplemented methods.
Fixed formatting in ByteArrayDecoder
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/312d8dd0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/312d8dd0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/312d8dd0
Branch: refs/heads/rajith-codec
Commit: 312d8dd08df4311bc3846d497e8e57a69952910e
Parents: bae9354
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri Feb 6 16:52:26 2015 -0500
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Thu Jul 9 09:12:37 2015 -0400
----------------------------------------------------------------------
.../qpid/proton/codec2/AbstractDecoder.java | 104 ++++++++++++++-----
.../qpid/proton/codec2/ByteArrayDecoder.java | 3 +-
2 files changed, 80 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/312d8dd0/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
index e17b6ee..032c2bf 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
@@ -24,18 +24,22 @@ import java.nio.charset.StandardCharsets;
/**
* AbstractDecoder
- *
+ *
*/
public abstract class AbstractDecoder implements Decoder
{
int start;
+
int offset;
+
int limit;
private int code;
+
private int size;
+
private int count;
abstract int readF8(int offset);
@@ -50,7 +54,8 @@ public abstract class AbstractDecoder implements Decoder
public void decode(DataHandler handler)
{
- while (offset < limit) {
+ while (offset < limit)
+ {
decodeType(handler);
decodeValue(handler);
}
@@ -59,7 +64,8 @@ public abstract class AbstractDecoder implements Decoder
private void decodeType(DataHandler handler)
{
code = readF8(offset++);
- if (code == 0) {
+ if (code == 0)
+ {
handler.onDescriptor(this);
decodeType(handler);
decodeValue(handler);
@@ -71,7 +77,8 @@ public abstract class AbstractDecoder implements Decoder
{
int copy;
- switch (code) {
+ switch (code)
+ {
case Encodings.NULL:
handler.onNull(this);
offset += Widths.NULL;
@@ -263,35 +270,43 @@ public abstract class AbstractDecoder implements Decoder
}
}
- private void decodeCompound(DataHandler handler) {
+ private void decodeCompound(DataHandler handler)
+ {
int copy = count;
- for (int i = 0; i < copy; i++) {
+ for (int i = 0; i < copy; i++)
+ {
decodeType(handler);
decodeValue(handler);
}
}
- private void decodeArray(DataHandler handler) {
+ private void decodeArray(DataHandler handler)
+ {
int copy = count;
decodeType(handler);
- for (int i = 0; i < copy; i++) {
+ for (int i = 0; i < copy; i++)
+ {
decodeValue(handler);
}
}
@Override
- public Type getType() {
+ public Type getType()
+ {
return Type.typeOf(code);
}
@Override
- public int getSize() {
+ public int getSize()
+ {
return count;
}
@Override
- public int getInt() {
- switch (code) {
+ public int getInt()
+ {
+ switch (code)
+ {
case Encodings.NULL:
case Encodings.FALSE:
return 0;
@@ -326,8 +341,10 @@ public abstract class AbstractDecoder implements Decoder
}
@Override
- public long getLong() {
- switch (code) {
+ public long getLong()
+ {
+ switch (code)
+ {
case Encodings.NULL:
case Encodings.FALSE:
return 0;
@@ -362,8 +379,10 @@ public abstract class AbstractDecoder implements Decoder
}
@Override
- public float getFloat() {
- switch (code) {
+ public float getFloat()
+ {
+ switch (code)
+ {
case Encodings.NULL:
case Encodings.FALSE:
return 0;
@@ -398,8 +417,10 @@ public abstract class AbstractDecoder implements Decoder
}
@Override
- public double getDouble() {
- switch (code) {
+ public double getDouble()
+ {
+ switch (code)
+ {
case Encodings.NULL:
case Encodings.FALSE:
return 0;
@@ -434,8 +455,10 @@ public abstract class AbstractDecoder implements Decoder
}
@Override
- public String getString() {
- switch (code) {
+ public String getString()
+ {
+ switch (code)
+ {
case Encodings.SYM32:
case Encodings.STR32:
return new String(readBytes(offset, size), StandardCharsets.UTF_8);
@@ -445,23 +468,54 @@ public abstract class AbstractDecoder implements Decoder
}
@Override
- public int getIntBits() {
+ public int getIntBits()
+ {
return readF32(offset);
}
@Override
- public long getLongBits() {
+ public long getLongBits()
+ {
return readF64(offset);
}
@Override
- public long getHiBits() {
+ public long getHiBits()
+ {
return readF64(offset);
}
@Override
- public long getLoBits() {
+ public long getLoBits()
+ {
return readF64(offset + 8);
}
-}
+ @Override
+ public byte getByte()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public short getShort()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean getBoolean()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public char getChar()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/312d8dd0/proton-j/src/main/java/org/apache/qpid/proton/codec2/ByteArrayDecoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/ByteArrayDecoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/ByteArrayDecoder.java
index 3a8214f..32c37e6 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/ByteArrayDecoder.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/ByteArrayDecoder.java
@@ -76,5 +76,4 @@ public final class ByteArrayDecoder extends AbstractDecoder
System.arraycopy(bytes, offset, result, 0, size);
return result;
}
-
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org