summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/BasicStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/IceInternal/BasicStream.java')
-rw-r--r--java/src/IceInternal/BasicStream.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java
index 659995acc2a..2541478d1d6 100644
--- a/java/src/IceInternal/BasicStream.java
+++ b/java/src/IceInternal/BasicStream.java
@@ -367,6 +367,17 @@ public class BasicStream
}
public void
+ endWriteEncapsChecked() // Used by public stream API.
+ {
+ if(_writeEncapsStack == null)
+ {
+ throw new Ice.EncapsulationException("not in an encapsulation");
+ }
+
+ endWriteEncaps();
+ }
+
+ public void
startReadEncaps()
{
{
@@ -478,6 +489,17 @@ public class BasicStream
}
}
+ public void
+ endReadEncapsChecked() // Used by public stream API.
+ {
+ if(_readEncapsStack == null)
+ {
+ throw new Ice.EncapsulationException("not in an encapsulation");
+ }
+
+ endReadEncaps();
+ }
+
public int
getReadEncapsSize()
{
@@ -592,6 +614,14 @@ public class BasicStream
public void
writeTypeId(String id)
{
+ if(_writeEncapsStack == null || _writeEncapsStack.typeIdMap == null)
+ {
+ //
+ // writeObject() must be called first.
+ //
+ throw new Ice.MarshalException("type ids require an encapsulation");
+ }
+
Integer index = _writeEncapsStack.typeIdMap.get(id);
if(index != null)
{
@@ -610,6 +640,14 @@ public class BasicStream
public String
readTypeId()
{
+ if(_readEncapsStack == null || _readEncapsStack.typeIdMap == null)
+ {
+ //
+ // readObject() must be called first.
+ //
+ throw new Ice.MarshalException("type ids require an encapsulation");
+ }
+
String id;
Integer index;
final boolean isIndex = readBool();