📄 abstractcdroutput.java
字号:
} } /** * Writes the double value (IEEE 754 format). */ public void write_double(double x) { try { align(8); b.writeDouble(x); } catch (Exception ex) { Unexpected.error(ex); } } /** * Writes the array of double values. */ public void write_double_array(double[] x, int ofs, int len) { try { align(8); for (int i = ofs; i < ofs + len; i++) { b.writeDouble(x [ i ]); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes CORBA fixed, storing all digits but not the scale. * The end of the record on <code>fixed</code> can * be determined from its last byte. */ public void write_fixed(BigDecimal fixed) { try { BigDecimalHelper.write(this, fixed); } catch (IOException ex) { Unexpected.error(ex); } catch (BadKind ex) { Unexpected.error(ex); } } /** * Write the float value (IEEE 754 format). */ public void write_float(float x) { try { align(4); b.writeFloat(x); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes an array of the float values. */ public void write_float_array(float[] x, int ofs, int len) { try { align(4); for (int i = ofs; i < ofs + len; i++) { b.writeFloat(x [ i ]); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the integer value (CORBA long, four bytes, high byte first). * @param x the value to write. */ public void write_long(int x) { try { align(4); b.writeInt(x); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the array of integer (CORBA long) values. * * @param x value * @param ofs offset * @param len length */ public void write_long_array(int[] x, int ofs, int len) { try { align(4); for (int i = ofs; i < ofs + len; i++) { b.writeInt(x [ i ]); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the long (CORBA long long) value, 8 bytes, * high byte first. * * @param x the value to write. */ public void write_longlong(long x) { try { align(8); b.writeLong(x); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the array of longs (CORBA long longs) values. * * @param x value * @param ofs offset * @param len length */ public void write_longlong_array(long[] x, int ofs, int len) { try { align(8); for (int i = ofs; i < ofs + len; i++) { b.writeLong(x [ i ]); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes this byte. * @param x */ public void write_octet(byte x) { try { b.writeByte(x); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the array of bytes (CORBA octets) values. * * @param x value * @param ofs offset * @param len length */ public void write_octet_array(byte[] x, int ofs, int len) { try { b.write(x, ofs, len); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes first the size of array, and then the byte array using * the {@link java.io.OutputStream#write(byte[]) }. The sequence * being written is preceeded by the int, representing the array * length. */ public void write_sequence(byte[] buf) { try { write_long(buf.length); write(buf); } catch (IOException ex) { MARSHAL t = new MARSHAL(); t.minor = Minor.CDR; t.initCause(ex); throw t; } } /** * Writes the contents of the provided stream. * The sequence being written is preceeded by the int, * representing the stream buffer length (the number of * bytes being subsequently written). */ public void write_sequence(BufferedCdrOutput from) { try { write_long(from.buffer.size()); from.buffer.writeTo(this); } catch (IOException ex) { MARSHAL t = new MARSHAL(); t.minor = Minor.CDR; t.initCause(ex); throw t; } } /** * Writes the two byte integer (short), high byte first. * * @param x the integer to write. */ public void write_short(short x) { try { align(2); b.writeShort(x); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the array of short (two byte integer) values. * * @param x value * @param ofs offset * @param len length */ public void write_short_array(short[] x, int ofs, int len) { try { align(2); for (int i = ofs; i < ofs + len; i++) { b.writeShort(x [ i ]); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the string. This implementation first calls * String.getBytes() and then writes the length of the returned * array (as CORBA ulong) and the returned array itself. * * The encoding information, if previously set, is taken * into consideration. * * @param x the string to write. */ public void write_string(String x) { try { byte[] ab = x.getBytes(narrow_charset); write_long(ab.length + 1); write(ab); // write null terminator. write(0); } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the CORBA unsigned long in the same way as CORBA long. */ public void write_ulong(int x) { write_long(x); } /** * Writes the array of CORBA unsigned longs in the same way as * array of ordinary longs. */ public void write_ulong_array(int[] x, int ofs, int len) { write_long_array(x, ofs, len); } /** * Write the unsigned long long in the same way as an ordinary long long. * * @param x a value to write. */ public void write_ulonglong(long x) { write_longlong(x); } /** * Write the array of unsingel long longs in the same way * an an array of the ordinary long longs. */ public void write_ulonglong_array(long[] x, int ofs, int len) { write_longlong_array(x, ofs, len); } /** * Write the unsigned short in the same way as an ordinary short. */ public void write_ushort(short x) { write_short(x); } /** * Write an array of unsigned short integersin the same way * as an array of ordinary short integers. */ public void write_ushort_array(short[] x, int ofs, int len) { write_short_array(x, ofs, len); } /** * Writes the character as two byte short integer (Unicode value), high byte * first. Writes in Big Endian, but never writes the endian indicator. * * The character is always written using the native UTF-16BE charset because * its size under arbitrary encoding is not evident. */ public void write_wchar(char x) { try { if (giop.until_inclusive(1, 1)) { align(2); if (wide_native) b.writeShort(x); else { OutputStreamWriter ow = new OutputStreamWriter( (OutputStream) b, wide_charset); ow.write(x); ow.flush(); } } else if (wide_native) { b.writeByte(2); b.writeChar(x); } else { String encoded = new String(new char[] { x }); byte[] bytes = encoded.getBytes(wide_charset); b.write(bytes.length + 2); b.write(bytes); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Write the array of wide chars. * * @param chars the array of wide chars * @param offset offset * @param length length * * The char array is always written using the native UTF-16BE charset because * the character size under arbitrary encoding is not evident. */ public void write_wchar_array(char[] chars, int offset, int length) { try { if (giop.until_inclusive(1, 1)) align(2); if (wide_native) { for (int i = offset; i < offset + length; i++) { b.writeShort(chars [ i ]); } } else { OutputStreamWriter ow = new OutputStreamWriter((OutputStream) b, wide_charset); ow.write(chars, offset, length); ow.flush(); } } catch (IOException ex) { Unexpected.error(ex); } } /** * Writes the length of the string in bytes (not characters) and * then all characters as two byte unicode chars. Adds the * Big Endian indicator, 0xFFFE, at the beginning and null wide char at * the end. * * @param x the string to write. */ public void write_wstring(String x) { try { if (giop.since_inclusive(1, 2)) { byte[] bytes = x.getBytes(wide_charset); write_sequence(bytes); } else { // Encoding with null terminator always in UTF-16. // The wide null terminator needs extra two bytes. write_long(2 * x.length() + 2); for (int i = 0; i < x.length(); i++) { b.writeShort(x.charAt(i)); } // Write null terminator. b.writeShort(0); } } catch (IOException ex) { Unexpected.error(ex); } } /** {@inheritDoc} */ public void write_any_array(Any[] anys, int offset, int length) { for (int i = offset; i < offset + length; i++) { write_any(anys [ i ]); } } public String[] _truncatable_ids() { /**@todo Implement this org.omg.CORBA.portable.ValueBase abstract method*/ throw new java.lang.UnsupportedOperationException("Method _truncatable_ids() not yet implemented."); } /** {@inheritDoc} */ public void write_Abstract(java.lang.Object value) { write_abstract_interface(value); } /** {@inheritDoc} */ public void write_Value(Serializable value) { write_value(value); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -