862 * significant difference between writing a String into the stream as 863 * primitive data or as an Object. A String instance written by writeObject 864 * is written into the stream as a String initially. Future writeObject() 865 * calls write references to the string into the stream. 866 * 867 * @param str the String to be written 868 * @throws IOException if I/O errors occur while writing to the underlying 869 * stream 870 */ 871 public void writeUTF(String str) throws IOException { 872 bout.writeUTF(str); 873 } 874 875 /** 876 * Provide programmatic access to the persistent fields to be written 877 * to ObjectOutput. 878 * 879 * @since 1.2 880 */ 881 public abstract static class PutField { 882 883 /** 884 * Put the value of the named boolean field into the persistent field. 885 * 886 * @param name the name of the serializable field 887 * @param val the value to assign to the field 888 * @throws IllegalArgumentException if <code>name</code> does not 889 * match the name of a serializable field for the class whose fields 890 * are being written, or if the type of the named field is not 891 * <code>boolean</code> 892 */ 893 public abstract void put(String name, boolean val); 894 895 /** 896 * Put the value of the named byte field into the persistent field. 897 * 898 * @param name the name of the serializable field 899 * @param val the value to assign to the field 900 * @throws IllegalArgumentException if <code>name</code> does not 901 * match the name of a serializable field for the class whose fields | 862 * significant difference between writing a String into the stream as 863 * primitive data or as an Object. A String instance written by writeObject 864 * is written into the stream as a String initially. Future writeObject() 865 * calls write references to the string into the stream. 866 * 867 * @param str the String to be written 868 * @throws IOException if I/O errors occur while writing to the underlying 869 * stream 870 */ 871 public void writeUTF(String str) throws IOException { 872 bout.writeUTF(str); 873 } 874 875 /** 876 * Provide programmatic access to the persistent fields to be written 877 * to ObjectOutput. 878 * 879 * @since 1.2 880 */ 881 public abstract static class PutField { 882 /** 883 * Constructor for subclasses to call. 884 */ 885 public PutField() {} 886 887 /** 888 * Put the value of the named boolean field into the persistent field. 889 * 890 * @param name the name of the serializable field 891 * @param val the value to assign to the field 892 * @throws IllegalArgumentException if <code>name</code> does not 893 * match the name of a serializable field for the class whose fields 894 * are being written, or if the type of the named field is not 895 * <code>boolean</code> 896 */ 897 public abstract void put(String name, boolean val); 898 899 /** 900 * Put the value of the named byte field into the persistent field. 901 * 902 * @param name the name of the serializable field 903 * @param val the value to assign to the field 904 * @throws IllegalArgumentException if <code>name</code> does not 905 * match the name of a serializable field for the class whose fields |