/** * Write repository Id, probably shared. */ static void write_string_array(OutputStream output, String[] ids) { if (output instanceof gnuValueStream) { gnuValueStream b = (gnuValueStream) output; if (b != null) { int written = b.getRunTime().idWrittenAt(ids); if (written >= 0) { // Reuse existing id record. output.write_long(vt_INDIRECTION); int p = b.getPosition(); output.write_long(written - p); } else { b.getRunTime().multipleIdsWritten(ids, b.getPosition()); StringSeqHelper.write(output, ids); } } } else StringSeqHelper.write(output, ids); }
/** Passes and returns the string sequence. */ public String[] passStrings(String[] arg) { InputStream in = null; try { // Get the stream where the parameters must be written: OutputStream out = _request("passStrings", true); // Wrap the string array using the string sequence helper. StringSeqHelper.write(out, arg); // Invoke the method. in = _invoke(out); // Read the returned result using the string sequence helper. String[] result = StringSeqHelper.read(in); return result; } catch (ApplicationException ex) { // Handle the exception, thrown on remote side. in = ex.getInputStream(); throw new MARSHAL(ex.getId()); } catch (RemarshalException _rm) { return passStrings(arg); } finally { _releaseReply(in); } }
/** * Read string array, expecting the probable indirection. */ static String[] read_string_array(InputStream input) { gnuValueStream g = (gnuValueStream) input; int previous = g.getPosition(); int l = input.read_long(); if (l != vt_INDIRECTION) { g.seek(previous); String[] s = StringSeqHelper.read(input); if (g.getRunTime() == null) g.setRunTime(new gnuRuntime(null, null)); g.getRunTime().objectWritten(s, previous); return s; } else { gnuRuntime r = g.getRunTime(); int base = g.getPosition(); int delta = input.read_long(); if (r == null) { previous = g.getPosition(); g.seek(base + delta); String[] indir = StringSeqHelper.read(input); g.seek(previous); return indir; } else { return (String[]) r.isObjectWrittenAt(base + delta, delta); } } }
/** * Reads the <code>String[]</code> from the CORBA input stream. * * @param input the CORBA stream to read from. * @return the value from the stream. */ public static String[] read(InputStream input) { return StringSeqHelper.read(input); }
/** * Writes the <code>String[]</code> into the given stream. * * @param output the CORBA output stream to write. * @param value the value that must be written. */ public static void write(OutputStream output, String[] value) { StringSeqHelper.write(output, value); }