Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
View | Details | Raw Unified | Return to bug 958
Collapse All | Expand All

(-)a/src/org/jacorb/orb/CDROutputStream.java (-23 / +66 lines)
Lines 78-84 public class CDROutputStream Link Here
78
        size, but that have not yet been written */
78
        size, but that have not yet been written */
79
    private int deferred_writes;
79
    private int deferred_writes;
80
80
81
    private final IBufferManager bufMgr;
81
    private IBufferManager bufMgr;
82
    protected byte[] buffer;
82
    protected byte[] buffer;
83
83
84
    private boolean closed;
84
    private boolean closed;
Lines 156-162 public class CDROutputStream Link Here
156
156
157
    private int deferredArrayQueueSize;
157
    private int deferredArrayQueueSize;
158
158
159
    protected final org.jacorb.orb.ORBSingleton orb;
159
    protected org.jacorb.orb.ORBSingleton orb;
160
160
161
    protected int giop_minor = 2;
161
    protected int giop_minor = 2;
162
162
Lines 184-190 public class CDROutputStream Link Here
184
    // by default stream version is 1 for GIOP v1.2 messages
184
    // by default stream version is 1 for GIOP v1.2 messages
185
    private byte maxStreamFormatVersion = ValueHandler.STREAM_FORMAT_VERSION_1;
185
    private byte maxStreamFormatVersion = ValueHandler.STREAM_FORMAT_VERSION_1;
186
186
187
    private final TypeCodeCompactor typeCodeCompactor;
187
    private TypeCodeCompactor typeCodeCompactor;
188
188
189
    private final static DelegatingTypeCodeWriter typeCodeWriter = new DelegatingTypeCodeWriter();
189
    private final static DelegatingTypeCodeWriter typeCodeWriter = new DelegatingTypeCodeWriter();
190
190
Lines 208-230 public class CDROutputStream Link Here
208
    }
208
    }
209
209
210
    /**
210
    /**
211
     * internal c'tor
211
     * size selecting c'tor
212
     * @param orb must be a JacORB ORB
212
     * @param orb must be a JacORB ORB
213
     * @param bufferSize -1 to fetch the default buffer size,
213
     * @param bufferSize -1 to fetch the default buffer size,
214
     *        value > 0 to specify a specific size
214
     *        value > 0 to specify a specific size
215
     * @param no_deferred true overrides the configured deferred writes bhavior
216
     *        and forces all date into the single buffer while marshalling
215
     */
217
     */
216
    private CDROutputStream(org.omg.CORBA.ORB orb, int bufferSize)
218
    public CDROutputStream(org.omg.CORBA.ORB orb, int bufferSize, boolean no_deferred)
217
    {
219
    {
218
        super();
220
        super();
219
221
220
        if (! (orb instanceof ORBSingleton))
222
        shared_init (orb, no_deferred);
221
        {
222
            throw new BAD_PARAM("don't pass in a non JacORB ORB");
223
        }
224
225
        this.orb = (ORBSingleton) orb;
226
        bufMgr = this.orb.getBufferManager();
227
        typeCodeCompactor = this.orb.getTypeCodeCompactor();
228
223
229
        if (bufferSize == -1)
224
        if (bufferSize == -1)
230
        {
225
        {
Lines 234-240 public class CDROutputStream Link Here
234
        {
229
        {
235
            buffer = bufMgr.getBuffer(bufferSize);
230
            buffer = bufMgr.getBuffer(bufferSize);
236
        }
231
        }
232
233
    }
234
235
    /**
236
     * buffer supplying c'tor
237
     * @param orb must be a JacORB ORB
238
     * @param bufferSize -1 to fetch the default buffer size,
239
     *        value > 0 to specify a specific size
240
     * @param no_deferred true overrides the configured deferred writes bhavior
241
     *        and forces all date into the single buffer while marshalling
242
     */
243
    public CDROutputStream(org.omg.CORBA.ORB orb, byte [] extbuff )
244
    {
245
        super();
246
        shared_init (orb, true);
247
        this.buffer = extbuff;
237
    }
248
    }
249
238
    /**
250
    /**
239
     * OutputStreams created using this constructor
251
     * OutputStreams created using this constructor
240
     * are used also for in memory marshaling, but do use the
252
     * are used also for in memory marshaling, but do use the
Lines 242-257 public class CDROutputStream Link Here
242
     */
254
     */
243
    public CDROutputStream(final org.omg.CORBA.ORB orb)
255
    public CDROutputStream(final org.omg.CORBA.ORB orb)
244
    {
256
    {
245
        this(orb, -1);
257
      this(orb, -1, false);
246
247
        try
248
        {
249
            configure(((ORBSingleton)orb).getConfiguration());
250
        }
251
        catch(ConfigurationException e)
252
        {
253
            throw new INTERNAL(e.getMessage());
254
        }
255
    }
258
    }
256
259
257
    /**
260
    /**
Lines 271-276 public class CDROutputStream Link Here
271
    }
274
    }
272
275
273
276
277
    private void shared_init (org.omg.CORBA.ORB orb, boolean no_deferred)
278
    {
279
        if (! (orb instanceof ORBSingleton))
280
        {
281
            throw new BAD_PARAM("don't pass in a non JacORB ORB");
282
        }
283
284
        this.orb = (ORBSingleton) orb;
285
        bufMgr = this.orb.getBufferManager();
286
        typeCodeCompactor = this.orb.getTypeCodeCompactor();
287
288
        try
289
        {
290
            configure(((ORBSingleton)orb).getConfiguration());
291
        }
292
        catch(ConfigurationException e)
293
        {
294
            throw new INTERNAL(e.getMessage());
295
        }
296
297
        if (no_deferred)
298
        {
299
            deferredArrayQueueSize = 0;
300
        }
301
    }
274
302
275
    /**
303
    /**
276
     * This stream is self-configuring, i.e. configure() is private
304
     * This stream is self-configuring, i.e. configure() is private
Lines 711-716 public class CDROutputStream Link Here
711
        index = 0;
739
        index = 0;
712
    }
740
    }
713
741
742
    /**
743
     * Give up the buffer to the caller. It is up to the caller to
744
     * eventually return the buffer to the manager, if appropriate.
745
     */
746
747
    public byte[] releaseBuffer ()
748
    {
749
        byte [] retn = buffer;
750
        buffer = null;
751
        deferredArrayQueue = null;
752
        pos = 0;
753
        deferred_writes = 0;
754
        index = 0;
755
        return retn;
756
    }
714
757
715
    /**************************************************
758
    /**************************************************
716
     * The following operations are from OutputStream *
759
     * The following operations are from OutputStream *

Return to bug 958