Merge with trunk arithmetic
authorLubomir Nerad <lubomir.nerad@oracle.com>
Wed, 27 Feb 2013 11:24:58 +0100
brancharithmetic
changeset 77442bc1e89134d
parent 755 5652acd48509
parent 773 406faa8bc64f
child 778 6f8683517f1f
Merge with trunk
core/pom.xml
core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java
core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java
core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java
core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java
core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java
emul/compact/pom.xml
emul/compact/src/main/assembly/rt.xml
emul/compact/src/main/java/java/beans/ChangeListenerMap.java
emul/compact/src/main/java/java/beans/IndexedPropertyChangeEvent.java
emul/compact/src/main/java/java/beans/PropertyChangeEvent.java
emul/compact/src/main/java/java/beans/PropertyChangeListener.java
emul/compact/src/main/java/java/beans/PropertyChangeListenerProxy.java
emul/compact/src/main/java/java/beans/PropertyChangeSupport.java
emul/compact/src/main/java/java/beans/PropertyVetoException.java
emul/compact/src/main/java/java/beans/VetoableChangeListener.java
emul/compact/src/main/java/java/beans/VetoableChangeListenerProxy.java
emul/compact/src/main/java/java/beans/VetoableChangeSupport.java
emul/compact/src/main/java/java/io/Bits.java
emul/compact/src/main/java/java/io/BufferedOutputStream.java
emul/compact/src/main/java/java/io/BufferedReader.java
emul/compact/src/main/java/java/io/ByteArrayOutputStream.java
emul/compact/src/main/java/java/io/DataOutput.java
emul/compact/src/main/java/java/io/DataOutputStream.java
emul/compact/src/main/java/java/io/Externalizable.java
emul/compact/src/main/java/java/io/FilterOutputStream.java
emul/compact/src/main/java/java/io/Flushable.java
emul/compact/src/main/java/java/io/InputStreamReader.java
emul/compact/src/main/java/java/io/InvalidClassException.java
emul/compact/src/main/java/java/io/InvalidObjectException.java
emul/compact/src/main/java/java/io/NotActiveException.java
emul/compact/src/main/java/java/io/NotSerializableException.java
emul/compact/src/main/java/java/io/ObjectInput.java
emul/compact/src/main/java/java/io/ObjectInputStream.java
emul/compact/src/main/java/java/io/ObjectInputValidation.java
emul/compact/src/main/java/java/io/ObjectOutput.java
emul/compact/src/main/java/java/io/ObjectOutputStream.java
emul/compact/src/main/java/java/io/ObjectStreamClass.java
emul/compact/src/main/java/java/io/ObjectStreamConstants.java
emul/compact/src/main/java/java/io/ObjectStreamException.java
emul/compact/src/main/java/java/io/ObjectStreamField.java
emul/compact/src/main/java/java/io/OptionalDataException.java
emul/compact/src/main/java/java/io/OutputStream.java
emul/compact/src/main/java/java/io/Reader.java
emul/compact/src/main/java/java/io/StreamCorruptedException.java
emul/compact/src/main/java/java/io/WriteAbortedException.java
emul/compact/src/main/java/java/lang/AbstractMethodError.java
emul/compact/src/main/java/java/lang/Cloneable.java
emul/compact/src/main/java/java/lang/IncompatibleClassChangeError.java
emul/compact/src/main/java/java/lang/InternalError.java
emul/compact/src/main/java/java/lang/Iterable.java
emul/compact/src/main/java/java/lang/NoSuchFieldError.java
emul/compact/src/main/java/java/lang/Readable.java
emul/compact/src/main/java/java/lang/SafeVarargs.java
emul/compact/src/main/java/java/lang/SuppressWarnings.java
emul/compact/src/main/java/java/lang/System.java
emul/compact/src/main/java/java/lang/ref/PhantomReference.java
emul/compact/src/main/java/java/lang/ref/Reference.java
emul/compact/src/main/java/java/lang/ref/ReferenceQueue.java
emul/compact/src/main/java/java/lang/ref/SoftReference.java
emul/compact/src/main/java/java/lang/ref/WeakReference.java
emul/compact/src/main/java/java/lang/ref/package.html
emul/compact/src/main/java/java/util/AbstractCollection.java
emul/compact/src/main/java/java/util/AbstractList.java
emul/compact/src/main/java/java/util/AbstractMap.java
emul/compact/src/main/java/java/util/AbstractQueue.java
emul/compact/src/main/java/java/util/AbstractSequentialList.java
emul/compact/src/main/java/java/util/AbstractSet.java
emul/compact/src/main/java/java/util/ArrayDeque.java
emul/compact/src/main/java/java/util/ArrayList.java
emul/compact/src/main/java/java/util/Arrays.java
emul/compact/src/main/java/java/util/Collection.java
emul/compact/src/main/java/java/util/Collections.java
emul/compact/src/main/java/java/util/ComparableTimSort.java
emul/compact/src/main/java/java/util/ConcurrentModificationException.java
emul/compact/src/main/java/java/util/Deque.java
emul/compact/src/main/java/java/util/Dictionary.java
emul/compact/src/main/java/java/util/DualPivotQuicksort.java
emul/compact/src/main/java/java/util/EmptyStackException.java
emul/compact/src/main/java/java/util/EventListener.java
emul/compact/src/main/java/java/util/EventListenerProxy.java
emul/compact/src/main/java/java/util/EventObject.java
emul/compact/src/main/java/java/util/HashMap.java
emul/compact/src/main/java/java/util/HashSet.java
emul/compact/src/main/java/java/util/Hashtable.java
emul/compact/src/main/java/java/util/Iterator.java
emul/compact/src/main/java/java/util/LinkedHashMap.java
emul/compact/src/main/java/java/util/LinkedList.java
emul/compact/src/main/java/java/util/List.java
emul/compact/src/main/java/java/util/ListIterator.java
emul/compact/src/main/java/java/util/Map.java
emul/compact/src/main/java/java/util/Objects.java
emul/compact/src/main/java/java/util/PriorityQueue.java
emul/compact/src/main/java/java/util/Queue.java
emul/compact/src/main/java/java/util/Random.java
emul/compact/src/main/java/java/util/RandomAccess.java
emul/compact/src/main/java/java/util/ServiceConfigurationError.java
emul/compact/src/main/java/java/util/ServiceLoader.java
emul/compact/src/main/java/java/util/Set.java
emul/compact/src/main/java/java/util/SortedMap.java
emul/compact/src/main/java/java/util/SortedSet.java
emul/compact/src/main/java/java/util/Stack.java
emul/compact/src/main/java/java/util/StringTokenizer.java
emul/compact/src/main/java/java/util/TimSort.java
emul/compact/src/main/java/java/util/Vector.java
emul/compact/src/main/java/java/util/concurrent/Callable.java
emul/compact/src/main/java/java/util/concurrent/TimeUnit.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/CollectionsTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/JFXIssuesTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/RandomTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ReaderTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ServiceLoaderTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ZipArchive.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ZipCompatibilityTest.java
emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ZipVsJzLibTest.java
emul/compact/src/test/resources/org/apidesign/bck2brwsr/compact/tck/demo.static.calculator-0.3-SNAPSHOT.jar
emul/mini/pom.xml
emul/mini/src/main/java/java/io/ByteArrayInputStream.java
emul/mini/src/main/java/java/io/Closeable.java
emul/mini/src/main/java/java/io/DataInput.java
emul/mini/src/main/java/java/io/DataInputStream.java
emul/mini/src/main/java/java/io/EOFException.java
emul/mini/src/main/java/java/io/FilterInputStream.java
emul/mini/src/main/java/java/io/IOException.java
emul/mini/src/main/java/java/io/InputStream.java
emul/mini/src/main/java/java/io/PushbackInputStream.java
emul/mini/src/main/java/java/io/Serializable.java
emul/mini/src/main/java/java/io/UTFDataFormatException.java
emul/mini/src/main/java/java/io/UnsupportedEncodingException.java
emul/mini/src/main/java/java/lang/AbstractStringBuilder.java
emul/mini/src/main/java/java/lang/Appendable.java
emul/mini/src/main/java/java/lang/ArrayIndexOutOfBoundsException.java
emul/mini/src/main/java/java/lang/ArrayStoreException.java
emul/mini/src/main/java/java/lang/AssertionError.java
emul/mini/src/main/java/java/lang/AutoCloseable.java
emul/mini/src/main/java/java/lang/Boolean.java
emul/mini/src/main/java/java/lang/Byte.java
emul/mini/src/main/java/java/lang/CharSequence.java
emul/mini/src/main/java/java/lang/Character.java
emul/mini/src/main/java/java/lang/Class.java
emul/mini/src/main/java/java/lang/ClassCastException.java
emul/mini/src/main/java/java/lang/ClassFormatError.java
emul/mini/src/main/java/java/lang/ClassLoader.java
emul/mini/src/main/java/java/lang/ClassNotFoundException.java
emul/mini/src/main/java/java/lang/CloneNotSupportedException.java
emul/mini/src/main/java/java/lang/Cloneable.java
emul/mini/src/main/java/java/lang/Comparable.java
emul/mini/src/main/java/java/lang/Deprecated.java
emul/mini/src/main/java/java/lang/Double.java
emul/mini/src/main/java/java/lang/Enum.java
emul/mini/src/main/java/java/lang/Error.java
emul/mini/src/main/java/java/lang/Exception.java
emul/mini/src/main/java/java/lang/Float.java
emul/mini/src/main/java/java/lang/IllegalAccessError.java
emul/mini/src/main/java/java/lang/IllegalAccessException.java
emul/mini/src/main/java/java/lang/IllegalArgumentException.java
emul/mini/src/main/java/java/lang/IllegalStateException.java
emul/mini/src/main/java/java/lang/IncompatibleClassChangeError.java
emul/mini/src/main/java/java/lang/IndexOutOfBoundsException.java
emul/mini/src/main/java/java/lang/InstantiationException.java
emul/mini/src/main/java/java/lang/Integer.java
emul/mini/src/main/java/java/lang/InterruptedException.java
emul/mini/src/main/java/java/lang/LinkageError.java
emul/mini/src/main/java/java/lang/Long.java
emul/mini/src/main/java/java/lang/Math.java
emul/mini/src/main/java/java/lang/NegativeArraySizeException.java
emul/mini/src/main/java/java/lang/NoSuchMethodException.java
emul/mini/src/main/java/java/lang/NullPointerException.java
emul/mini/src/main/java/java/lang/Number.java
emul/mini/src/main/java/java/lang/NumberFormatException.java
emul/mini/src/main/java/java/lang/Object.java
emul/mini/src/main/java/java/lang/OutOfMemoryError.java
emul/mini/src/main/java/java/lang/Override.java
emul/mini/src/main/java/java/lang/ReflectiveOperationException.java
emul/mini/src/main/java/java/lang/Runnable.java
emul/mini/src/main/java/java/lang/RuntimeException.java
emul/mini/src/main/java/java/lang/SecurityException.java
emul/mini/src/main/java/java/lang/Short.java
emul/mini/src/main/java/java/lang/StackTraceElement.java
emul/mini/src/main/java/java/lang/String.java
emul/mini/src/main/java/java/lang/StringBuffer.java
emul/mini/src/main/java/java/lang/StringBuilder.java
emul/mini/src/main/java/java/lang/StringIndexOutOfBoundsException.java
emul/mini/src/main/java/java/lang/Throwable.java
emul/mini/src/main/java/java/lang/VirtualMachineError.java
emul/mini/src/main/java/java/lang/Void.java
emul/mini/src/main/java/java/lang/annotation/Annotation.java
emul/mini/src/main/java/java/lang/annotation/Documented.java
emul/mini/src/main/java/java/lang/annotation/ElementType.java
emul/mini/src/main/java/java/lang/annotation/Retention.java
emul/mini/src/main/java/java/lang/annotation/RetentionPolicy.java
emul/mini/src/main/java/java/lang/annotation/Target.java
emul/mini/src/main/java/java/lang/annotation/UnsupportedOperationException.java
emul/mini/src/main/java/java/lang/reflect/AccessibleObject.java
emul/mini/src/main/java/java/lang/reflect/AnnotatedElement.java
emul/mini/src/main/java/java/lang/reflect/Array.java
emul/mini/src/main/java/java/lang/reflect/Constructor.java
emul/mini/src/main/java/java/lang/reflect/Field.java
emul/mini/src/main/java/java/lang/reflect/GenericDeclaration.java
emul/mini/src/main/java/java/lang/reflect/InvocationHandler.java
emul/mini/src/main/java/java/lang/reflect/InvocationTargetException.java
emul/mini/src/main/java/java/lang/reflect/Member.java
emul/mini/src/main/java/java/lang/reflect/Method.java
emul/mini/src/main/java/java/lang/reflect/Modifier.java
emul/mini/src/main/java/java/lang/reflect/Proxy.java
emul/mini/src/main/java/java/lang/reflect/Type.java
emul/mini/src/main/java/java/lang/reflect/TypeVariable.java
emul/mini/src/main/java/java/lang/reflect/UndeclaredThrowableException.java
emul/mini/src/main/java/java/lang/reflect/package-info.java
emul/mini/src/main/java/java/net/MalformedURLException.java
emul/mini/src/main/java/java/net/URL.java
emul/mini/src/main/java/java/net/URLStreamHandler.java
emul/mini/src/main/java/java/util/Comparator.java
emul/mini/src/main/java/java/util/Enumeration.java
emul/mini/src/main/java/java/util/NoSuchElementException.java
emul/mini/src/main/java/java/util/zip/Adler32.java
emul/mini/src/main/java/java/util/zip/CRC32.java
emul/mini/src/main/java/java/util/zip/Checksum.java
emul/mini/src/main/java/java/util/zip/DataFormatException.java
emul/mini/src/main/java/java/util/zip/Inflater.java
emul/mini/src/main/java/java/util/zip/InflaterInputStream.java
emul/mini/src/main/java/java/util/zip/ZStreamRef.java
emul/mini/src/main/java/java/util/zip/ZipConstants.java
emul/mini/src/main/java/java/util/zip/ZipEntry.java
emul/mini/src/main/java/java/util/zip/ZipException.java
emul/mini/src/main/java/java/util/zip/ZipInputStream.java
emul/mini/src/main/java/java/util/zip/package.html
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/ManifestInputStream.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/reflect/AnnotationImpl.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/reflect/MethodImpl.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/reflect/TypeProvider.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/Adler32.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/CRC32.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/Checksum.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/FastJar.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/GZIPHeader.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/InfBlocks.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/InfCodes.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/InfTree.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/Inflate.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/Inflater.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/JzLibInflater.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/ZStream.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/ZipConstants64.java
emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/zip/ZipInputStream.java
emul/mini/src/main/resources/org/apidesign/vm4brwsr/emul/lang/java_lang_Number.js
emul/mini/src/main/resources/org/apidesign/vm4brwsr/emul/lang/java_lang_String.js
emul/mini/src/test/java/org/apidesign/bck2brwsr/emul/reflect/MethodImplTest.java
emul/pom.xml
javap/pom.xml
javap/src/main/java/org/apidesign/javap/AnnotationParser.java
javap/src/main/java/org/apidesign/javap/AttrData.java
javap/src/main/java/org/apidesign/javap/CPX.java
javap/src/main/java/org/apidesign/javap/CPX2.java
javap/src/main/java/org/apidesign/javap/ClassData.java
javap/src/main/java/org/apidesign/javap/Constants.java
javap/src/main/java/org/apidesign/javap/FieldData.java
javap/src/main/java/org/apidesign/javap/Hashtable.java
javap/src/main/java/org/apidesign/javap/InnerClassData.java
javap/src/main/java/org/apidesign/javap/LineNumData.java
javap/src/main/java/org/apidesign/javap/LocVarData.java
javap/src/main/java/org/apidesign/javap/MethodData.java
javap/src/main/java/org/apidesign/javap/RuntimeConstants.java
javap/src/main/java/org/apidesign/javap/StackMapData.java
javap/src/main/java/org/apidesign/javap/StackMapIterator.java
javap/src/main/java/org/apidesign/javap/StackMapTableData.java
javap/src/main/java/org/apidesign/javap/TrapData.java
javap/src/main/java/org/apidesign/javap/TrapDataIterator.java
javap/src/main/java/org/apidesign/javap/TypeArray.java
javap/src/main/java/org/apidesign/javap/Vector.java
launcher/pom.xml
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/InvocationContext.java
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/JSLauncher.java
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java
launcher/src/main/resources/org/apidesign/bck2brwsr/launcher/harness.xhtml
mojo/pom.xml
mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java
mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java
mojo/src/main/resources/META-INF/maven/archetype-metadata.xml
mojo/src/main/resources/archetype-resources/bck2brwsr-assembly.xml
mojo/src/main/resources/archetype-resources/nbactions.xml
mojo/src/main/resources/archetype-resources/pom.xml
mojo/src/main/resources/archetype-resources/src/main/java/App.java
mojo/src/main/resources/archetype-resources/src/main/resources/index.html
mojo/src/main/resources/archetype-resources/src/test/java/AppTest.java
mojo/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java
mojo/src/main/resources/archetype-resources/src/test/java/IntegrationTest.java
vm/pom.xml
vm/src/main/assembly/bck2brwsr.xml
vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java
vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
vm/src/main/java/org/apidesign/vm4brwsr/LocalsMapper.java
vm/src/main/java/org/apidesign/vm4brwsr/Main.java
vm/src/main/java/org/apidesign/vm4brwsr/ParseMan.java
vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java
vm/src/main/java/org/apidesign/vm4brwsr/StringArray.java
vm/src/main/java/org/apidesign/vm4brwsr/VM.java
vm/src/main/java/org/apidesign/vm4brwsr/VMLazy.java
vm/src/main/java/org/apidesign/vm4brwsr/VarType.java
vm/src/main/java/org/apidesign/vm4brwsr/Variable.java
vm/src/main/java/org/apidesign/vm4brwsr/Zips.java
vm/src/test/java/org/apidesign/vm4brwsr/Array.java
vm/src/test/java/org/apidesign/vm4brwsr/ArrayTest.java
vm/src/test/java/org/apidesign/vm4brwsr/ByteCodeToJavaScriptTest.java
vm/src/test/java/org/apidesign/vm4brwsr/BytesLoader.java
vm/src/test/java/org/apidesign/vm4brwsr/ClassTest.java
vm/src/test/java/org/apidesign/vm4brwsr/Classes.java
vm/src/test/java/org/apidesign/vm4brwsr/ClassesMarker.java
vm/src/test/java/org/apidesign/vm4brwsr/ClassesNamer.java
vm/src/test/java/org/apidesign/vm4brwsr/Exceptions.java
vm/src/test/java/org/apidesign/vm4brwsr/ExceptionsTest.java
vm/src/test/java/org/apidesign/vm4brwsr/GetByte.java
vm/src/test/java/org/apidesign/vm4brwsr/Instance.java
vm/src/test/java/org/apidesign/vm4brwsr/InstanceSub.java
vm/src/test/java/org/apidesign/vm4brwsr/InstanceSubTest.java
vm/src/test/java/org/apidesign/vm4brwsr/InstanceTest.java
vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java
vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java
vm/src/test/java/org/apidesign/vm4brwsr/Script.java
vm/src/test/java/org/apidesign/vm4brwsr/StaticMethod.java
vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java
vm/src/test/java/org/apidesign/vm4brwsr/StaticUse.java
vm/src/test/java/org/apidesign/vm4brwsr/StringArrayTest.java
vm/src/test/java/org/apidesign/vm4brwsr/StringSample.java
vm/src/test/java/org/apidesign/vm4brwsr/StringTest.java
vm/src/test/java/org/apidesign/vm4brwsr/SystemTest.java
vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java
vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java
vm/src/test/java/org/apidesign/vm4brwsr/VMinVM.java
vm/src/test/java/org/apidesign/vm4brwsr/VMinVMTest.java
vm/src/test/resources/org/apidesign/vm4brwsr/ko.js
vmtest/pom.xml
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/BrwsrTest.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Compare.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/HtmlFragment.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Http.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/VMTest.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/GenerateZip.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/GenerateZipProcessor.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/AssertionTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/BrwsrCheckTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ByteArithmeticTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/CloneTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/CompareByteArrayTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/CompareHashTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/CompareIntArrayTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/CompareStringsTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/HttpResourceTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/InheritanceA.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/InheritanceB.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/InheritanceTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/IntegerArithmeticTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/LongArithmeticTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionArrayTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ResourcesTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ShortArithmeticTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/StaticUse.java
vmtest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/CRC32Test.java
vmtest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/ZipEntryTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/ZipFileTest.java
vmtest/src/test/resources/org/apidesign/bck2brwsr/tck/0xfe
vmtest/src/test/resources/org/apidesign/bck2brwsr/tck/Resources.txt
     1.1 --- a/core/pom.xml	Mon Feb 25 19:00:08 2013 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,46 +0,0 @@
     1.4 -<?xml version="1.0"?>
     1.5 -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
     1.6 -    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     1.7 -  <modelVersion>4.0.0</modelVersion>
     1.8 -  <parent>
     1.9 -    <groupId>org.apidesign</groupId>
    1.10 -    <artifactId>bck2brwsr</artifactId>
    1.11 -    <version>0.3-SNAPSHOT</version>
    1.12 -  </parent>
    1.13 -  <groupId>org.apidesign.bck2brwsr</groupId>
    1.14 -  <artifactId>core</artifactId>
    1.15 -  <version>0.3-SNAPSHOT</version>
    1.16 -  <name>Core JS Annotations</name>
    1.17 -  <url>http://maven.apache.org</url>
    1.18 -    <build>
    1.19 -        <plugins>
    1.20 -            <plugin>
    1.21 -                <groupId>org.apache.maven.plugins</groupId>
    1.22 -                <artifactId>maven-compiler-plugin</artifactId>
    1.23 -                <version>2.3.2</version>
    1.24 -                <configuration>
    1.25 -                    <source>1.7</source>
    1.26 -                    <target>1.7</target>
    1.27 -                </configuration>
    1.28 -            </plugin>
    1.29 -        </plugins>
    1.30 -    </build>
    1.31 -    <properties>
    1.32 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    1.33 -  </properties>
    1.34 -  <dependencies>
    1.35 -    <dependency>
    1.36 -      <groupId>junit</groupId>
    1.37 -      <artifactId>junit</artifactId>
    1.38 -      <version>3.8.1</version>
    1.39 -      <scope>test</scope>
    1.40 -    </dependency>
    1.41 -    <dependency>
    1.42 -      <groupId>org.netbeans.api</groupId>
    1.43 -      <artifactId>org-openide-util-lookup</artifactId>
    1.44 -      <scope>provided</scope>
    1.45 -    </dependency>
    1.46 -  </dependencies>
    1.47 -    <description>Contains esential annotations for associating JavaScript code with
    1.48 -methods and classes.</description>
    1.49 -</project>
     2.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java	Mon Feb 25 19:00:08 2013 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,36 +0,0 @@
     2.4 -/**
     2.5 - * Back 2 Browser Bytecode Translator
     2.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     2.7 - *
     2.8 - * This program is free software: you can redistribute it and/or modify
     2.9 - * it under the terms of the GNU General Public License as published by
    2.10 - * the Free Software Foundation, version 2 of the License.
    2.11 - *
    2.12 - * This program is distributed in the hope that it will be useful,
    2.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.15 - * GNU General Public License for more details.
    2.16 - *
    2.17 - * You should have received a copy of the GNU General Public License
    2.18 - * along with this program. Look for COPYING file in the top folder.
    2.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    2.20 - */
    2.21 -package org.apidesign.bck2brwsr.core;
    2.22 -
    2.23 -import java.lang.annotation.ElementType;
    2.24 -import java.lang.annotation.Retention;
    2.25 -import java.lang.annotation.RetentionPolicy;
    2.26 -import java.lang.annotation.Target;
    2.27 -
    2.28 -/**
    2.29 - *
    2.30 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.31 - */
    2.32 -@Retention(RetentionPolicy.CLASS)
    2.33 -@Target(ElementType.TYPE)
    2.34 -public @interface ExtraJavaScript {
    2.35 -    /** location of a script to load */
    2.36 -    String resource();
    2.37 -    /** should the class file still be processed or not? */
    2.38 -    boolean processByteCode() default true;
    2.39 -}
     3.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Mon Feb 25 19:00:08 2013 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,51 +0,0 @@
     3.4 -/**
     3.5 - * Back 2 Browser Bytecode Translator
     3.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.7 - *
     3.8 - * This program is free software: you can redistribute it and/or modify
     3.9 - * it under the terms of the GNU General Public License as published by
    3.10 - * the Free Software Foundation, version 2 of the License.
    3.11 - *
    3.12 - * This program is distributed in the hope that it will be useful,
    3.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 - * GNU General Public License for more details.
    3.16 - *
    3.17 - * You should have received a copy of the GNU General Public License
    3.18 - * along with this program. Look for COPYING file in the top folder.
    3.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    3.20 - */
    3.21 -package org.apidesign.bck2brwsr.core;
    3.22 -
    3.23 -import java.lang.annotation.ElementType;
    3.24 -import java.lang.annotation.Retention;
    3.25 -import java.lang.annotation.RetentionPolicy;
    3.26 -import java.lang.annotation.Target;
    3.27 -
    3.28 -/** Put this method on a method in case it should have a special
    3.29 - * body in the <em>JavaScript</em>.
    3.30 - *
    3.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    3.32 - */
    3.33 -@Retention(RetentionPolicy.CLASS)
    3.34 -@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR })
    3.35 -public @interface JavaScriptBody {
    3.36 -    /** Names of parameters for the method. 
    3.37 -     * 
    3.38 -     * <!--
    3.39 -     * If not specified
    3.40 -     * it will be <code>arg0, arg1, arg2</code>. In case of
    3.41 -     * instance methods, the <code>arg0</code> is reference
    3.42 -     * to <code>this</code>.
    3.43 -     * -->
    3.44 -     * 
    3.45 -     * @return array of the names of parameters for the method
    3.46 -     *    in JavaScript
    3.47 -     */
    3.48 -    public String[] args();
    3.49 -    
    3.50 -    /** The actual body of the method in JavaScript. This string will be
    3.51 -     * put into generated header (ends with '{') and footer (ends with '}').
    3.52 -     */
    3.53 -    public String body();
    3.54 -}
     4.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java	Mon Feb 25 19:00:08 2013 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,37 +0,0 @@
     4.4 -/**
     4.5 - * Back 2 Browser Bytecode Translator
     4.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.7 - *
     4.8 - * This program is free software: you can redistribute it and/or modify
     4.9 - * it under the terms of the GNU General Public License as published by
    4.10 - * the Free Software Foundation, version 2 of the License.
    4.11 - *
    4.12 - * This program is distributed in the hope that it will be useful,
    4.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.15 - * GNU General Public License for more details.
    4.16 - *
    4.17 - * You should have received a copy of the GNU General Public License
    4.18 - * along with this program. Look for COPYING file in the top folder.
    4.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    4.20 - */
    4.21 -package org.apidesign.bck2brwsr.core;
    4.22 -
    4.23 -import java.lang.annotation.ElementType;
    4.24 -import java.lang.annotation.Retention;
    4.25 -import java.lang.annotation.RetentionPolicy;
    4.26 -import java.lang.annotation.Target;
    4.27 -
    4.28 -/** Don't include given field or method in generated JavaScript. Rather
    4.29 - * generate completely independent JavaScript code.
    4.30 - *
    4.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    4.32 - */
    4.33 -@Retention(RetentionPolicy.CLASS)
    4.34 -@Target({ ElementType.METHOD, ElementType.FIELD })
    4.35 -public @interface JavaScriptOnly {
    4.36 -    /** name of the variable to assign given value to */
    4.37 -    String name() default "";
    4.38 -    /** value to assign to given field */
    4.39 -    String value() default "";
    4.40 -}
     5.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java	Mon Feb 25 19:00:08 2013 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,44 +0,0 @@
     5.4 -/**
     5.5 - * Back 2 Browser Bytecode Translator
     5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, version 2 of the License.
    5.11 - *
    5.12 - * This program is distributed in the hope that it will be useful,
    5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 - * GNU General Public License for more details.
    5.16 - *
    5.17 - * You should have received a copy of the GNU General Public License
    5.18 - * along with this program. Look for COPYING file in the top folder.
    5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    5.20 - */
    5.21 -package org.apidesign.bck2brwsr.core;
    5.22 -
    5.23 -import java.lang.annotation.ElementType;
    5.24 -import java.lang.annotation.Retention;
    5.25 -import java.lang.annotation.RetentionPolicy;
    5.26 -import java.lang.annotation.Target;
    5.27 -
    5.28 -/** Controls how JavaScript inheritance should be handled.
    5.29 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    5.30 - */
    5.31 -@Retention(RetentionPolicy.CLASS)
    5.32 -@Target({ ElementType.TYPE })
    5.33 -public @interface JavaScriptPrototype {
    5.34 -    /** Expression that identifies the function where all methods
    5.35 -     * should be added into. If this attribute is unspecified
    5.36 -     * all methods are added to the same object specified by
    5.37 -     * {@link #prototype()}.
    5.38 -     * 
    5.39 -     * @return name of function to contain methods found in given class
    5.40 -     */
    5.41 -    String container() default "";
    5.42 -    /** Expression that defines the way to construct prototype for this
    5.43 -     * class.
    5.44 -     * @return expression to construct prototype
    5.45 -     */
    5.46 -    String prototype();
    5.47 -}
     6.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java	Mon Feb 25 19:00:08 2013 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,94 +0,0 @@
     6.4 -/**
     6.5 - * Back 2 Browser Bytecode Translator
     6.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.7 - *
     6.8 - * This program is free software: you can redistribute it and/or modify
     6.9 - * it under the terms of the GNU General Public License as published by
    6.10 - * the Free Software Foundation, version 2 of the License.
    6.11 - *
    6.12 - * This program is distributed in the hope that it will be useful,
    6.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.15 - * GNU General Public License for more details.
    6.16 - *
    6.17 - * You should have received a copy of the GNU General Public License
    6.18 - * along with this program. Look for COPYING file in the top folder.
    6.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    6.20 - */
    6.21 -package org.apidesign.bck2brwsr.core.impl;
    6.22 -
    6.23 -import java.util.Collections;
    6.24 -import java.util.HashSet;
    6.25 -import java.util.List;
    6.26 -import java.util.Set;
    6.27 -import javax.annotation.processing.AbstractProcessor;
    6.28 -import javax.annotation.processing.Completion;
    6.29 -import javax.annotation.processing.Completions;
    6.30 -import javax.annotation.processing.Processor;
    6.31 -import javax.annotation.processing.RoundEnvironment;
    6.32 -import javax.lang.model.element.AnnotationMirror;
    6.33 -import javax.lang.model.element.Element;
    6.34 -import javax.lang.model.element.ElementKind;
    6.35 -import javax.lang.model.element.ExecutableElement;
    6.36 -import javax.lang.model.element.TypeElement;
    6.37 -import javax.lang.model.element.VariableElement;
    6.38 -import javax.tools.Diagnostic;
    6.39 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    6.40 -import org.openide.util.lookup.ServiceProvider;
    6.41 -
    6.42 -/**
    6.43 - *
    6.44 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    6.45 - */
    6.46 -@ServiceProvider(service = Processor.class)
    6.47 -public final class JavaScriptProcesor extends AbstractProcessor {
    6.48 -    @Override
    6.49 -    public Set<String> getSupportedAnnotationTypes() {
    6.50 -        Set<String> set = new HashSet<>();
    6.51 -        set.add(JavaScriptBody.class.getName());
    6.52 -        return set;
    6.53 -    }
    6.54 -    
    6.55 -    @Override
    6.56 -    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    6.57 -        for (Element e : roundEnv.getElementsAnnotatedWith(JavaScriptBody.class)) {
    6.58 -            if (e.getKind() != ElementKind.METHOD && e.getKind() != ElementKind.CONSTRUCTOR) {
    6.59 -                continue;
    6.60 -            }
    6.61 -            ExecutableElement ee = (ExecutableElement)e;
    6.62 -            List<? extends VariableElement> params = ee.getParameters();
    6.63 -            
    6.64 -            JavaScriptBody jsb = e.getAnnotation(JavaScriptBody.class);
    6.65 -            if (jsb == null) {
    6.66 -                continue;
    6.67 -            }
    6.68 -            String[] arr = jsb.args();
    6.69 -            if (params.size() != arr.length) {
    6.70 -                processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Number of args arguments does not match real arguments!", e);
    6.71 -            }
    6.72 -        }
    6.73 -        return true;
    6.74 -    }
    6.75 -
    6.76 -    @Override
    6.77 -    public Iterable<? extends Completion> getCompletions(Element e, 
    6.78 -        AnnotationMirror annotation, ExecutableElement member, String userText
    6.79 -    ) {
    6.80 -        StringBuilder sb = new StringBuilder();
    6.81 -        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("args")) {
    6.82 -            ExecutableElement ee = (ExecutableElement) e;
    6.83 -            String sep = "";
    6.84 -            sb.append("{ ");
    6.85 -            for (VariableElement ve : ee.getParameters()) {
    6.86 -                sb.append(sep).append('"').append(ve.getSimpleName())
    6.87 -                    .append('"');
    6.88 -                sep = ", ";
    6.89 -            }
    6.90 -            sb.append(" }");
    6.91 -            return Collections.nCopies(1, Completions.of(sb.toString()));
    6.92 -        }
    6.93 -        return null;
    6.94 -    }
    6.95 -
    6.96 -    
    6.97 -}
     7.1 --- a/emul/compact/pom.xml	Mon Feb 25 19:00:08 2013 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,72 +0,0 @@
     7.4 -<?xml version="1.0"?>
     7.5 -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
     7.6 -    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     7.7 -  <modelVersion>4.0.0</modelVersion>
     7.8 -  <parent>
     7.9 -    <groupId>org.apidesign.bck2brwsr</groupId>
    7.10 -    <artifactId>emul.pom</artifactId>
    7.11 -    <version>0.3-SNAPSHOT</version>
    7.12 -  </parent>
    7.13 -  <groupId>org.apidesign.bck2brwsr</groupId>
    7.14 -  <artifactId>emul</artifactId>
    7.15 -  <version>0.3-SNAPSHOT</version>
    7.16 -  <name>Bck2Brwsr API Profile</name>
    7.17 -  <url>http://maven.apache.org</url>
    7.18 -  <properties>
    7.19 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    7.20 -  </properties>
    7.21 -  <dependencies>
    7.22 -    <dependency>
    7.23 -      <groupId>${project.groupId}</groupId>
    7.24 -      <artifactId>emul.mini</artifactId>
    7.25 -      <version>${project.version}</version>
    7.26 -      <scope>provided</scope>
    7.27 -    </dependency>
    7.28 -    <dependency>
    7.29 -      <groupId>${project.groupId}</groupId>
    7.30 -      <artifactId>vmtest</artifactId>
    7.31 -      <version>${project.version}</version>
    7.32 -      <scope>test</scope>
    7.33 -    </dependency>
    7.34 -    <dependency>
    7.35 -      <groupId>org.netbeans.api</groupId>
    7.36 -      <artifactId>org-openide-util-lookup</artifactId>
    7.37 -      <scope>test</scope>
    7.38 -    </dependency>
    7.39 -  </dependencies>
    7.40 -  <build>
    7.41 -      <plugins>
    7.42 -          <plugin>
    7.43 -              <groupId>org.apache.maven.plugins</groupId>
    7.44 -              <artifactId>maven-compiler-plugin</artifactId>
    7.45 -              <version>2.5.1</version>
    7.46 -              <configuration>
    7.47 -                  <compilerArguments>
    7.48 -                      <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
    7.49 -                  </compilerArguments>
    7.50 -                 <source>1.7</source>
    7.51 -                 <target>1.7</target>
    7.52 -              </configuration>
    7.53 -          </plugin>
    7.54 -         <plugin>
    7.55 -            <artifactId>maven-assembly-plugin</artifactId>
    7.56 -                <version>2.4</version>
    7.57 -                <executions>
    7.58 -                    <execution>
    7.59 -                        <id>rt</id>
    7.60 -                        <phase>package</phase>
    7.61 -                        <goals>
    7.62 -                            <goal>single</goal>
    7.63 -                        </goals>
    7.64 -                        <configuration>
    7.65 -                            <descriptors>
    7.66 -                                <descriptor>src/main/assembly/rt.xml</descriptor>
    7.67 -                            </descriptors>
    7.68 -                            <finalName>bck2brwsr-${project.version}</finalName>
    7.69 -                        </configuration>
    7.70 -                    </execution>
    7.71 -                </executions>                
    7.72 -            </plugin>      
    7.73 -      </plugins>
    7.74 -  </build>
    7.75 -</project>
     8.1 --- a/emul/compact/src/main/assembly/rt.xml	Mon Feb 25 19:00:08 2013 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,26 +0,0 @@
     8.4 -<?xml version="1.0"?>
     8.5 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
     8.6 -  <id>rt</id>
     8.7 -  <formats>
     8.8 -    <format>jar</format>
     8.9 -  </formats>
    8.10 -  <includeBaseDirectory>false</includeBaseDirectory>
    8.11 -  <dependencySets>
    8.12 -    <dependencySet>
    8.13 -      <useProjectArtifact>true</useProjectArtifact>
    8.14 -      <unpack>true</unpack>
    8.15 -      <scope>provided</scope>
    8.16 -      <unpackOptions>
    8.17 -        <excludes>
    8.18 -          <exclude>META-INF/maven/**</exclude>
    8.19 -        </excludes>
    8.20 -      </unpackOptions>
    8.21 -    </dependencySet>
    8.22 -  </dependencySets>
    8.23 -  <fileSets>
    8.24 -    <fileSet>
    8.25 -      <directory>${project.build.outputDirectory}</directory>
    8.26 -      <outputDirectory>/</outputDirectory>
    8.27 -    </fileSet>
    8.28 -  </fileSets>
    8.29 -</assembly>
    8.30 \ No newline at end of file
     9.1 --- a/emul/compact/src/main/java/java/beans/ChangeListenerMap.java	Mon Feb 25 19:00:08 2013 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,248 +0,0 @@
     9.4 -/*
     9.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
     9.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 - *
     9.8 - * This code is free software; you can redistribute it and/or modify it
     9.9 - * under the terms of the GNU General Public License version 2 only, as
    9.10 - * published by the Free Software Foundation.  Oracle designates this
    9.11 - * particular file as subject to the "Classpath" exception as provided
    9.12 - * by Oracle in the LICENSE file that accompanied this code.
    9.13 - *
    9.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 - * version 2 for more details (a copy is included in the LICENSE file that
    9.18 - * accompanied this code).
    9.19 - *
    9.20 - * You should have received a copy of the GNU General Public License version
    9.21 - * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 - *
    9.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 - * or visit www.oracle.com if you need additional information or have any
    9.26 - * questions.
    9.27 - */
    9.28 -package java.beans;
    9.29 -
    9.30 -import java.util.ArrayList;
    9.31 -import java.util.Collections;
    9.32 -import java.util.EventListener;
    9.33 -import java.util.EventListenerProxy;
    9.34 -import java.util.HashMap;
    9.35 -import java.util.List;
    9.36 -import java.util.Map;
    9.37 -import java.util.Map.Entry;
    9.38 -import java.util.Set;
    9.39 -import org.apidesign.bck2brwsr.emul.lang.System;
    9.40 -
    9.41 -/**
    9.42 - * This is an abstract class that provides base functionality
    9.43 - * for the {@link PropertyChangeSupport PropertyChangeSupport} class
    9.44 - * and the {@link VetoableChangeSupport VetoableChangeSupport} class.
    9.45 - *
    9.46 - * @see PropertyChangeListenerMap
    9.47 - * @see VetoableChangeListenerMap
    9.48 - *
    9.49 - * @author Sergey A. Malenkov
    9.50 - */
    9.51 -abstract class ChangeListenerMap<L extends EventListener> {
    9.52 -    private Map<String, L[]> map;
    9.53 -
    9.54 -    /**
    9.55 -     * Creates an array of listeners.
    9.56 -     * This method can be optimized by using
    9.57 -     * the same instance of the empty array
    9.58 -     * when {@code length} is equal to {@code 0}.
    9.59 -     *
    9.60 -     * @param length  the array length
    9.61 -     * @return        an array with specified length
    9.62 -     */
    9.63 -    protected abstract L[] newArray(int length);
    9.64 -
    9.65 -    /**
    9.66 -     * Creates a proxy listener for the specified property.
    9.67 -     *
    9.68 -     * @param name      the name of the property to listen on
    9.69 -     * @param listener  the listener to process events
    9.70 -     * @return          a proxy listener
    9.71 -     */
    9.72 -    protected abstract L newProxy(String name, L listener);
    9.73 -
    9.74 -    /**
    9.75 -     * Adds a listener to the list of listeners for the specified property.
    9.76 -     * This listener is called as many times as it was added.
    9.77 -     *
    9.78 -     * @param name      the name of the property to listen on
    9.79 -     * @param listener  the listener to process events
    9.80 -     */
    9.81 -    public final synchronized void add(String name, L listener) {
    9.82 -        if (this.map == null) {
    9.83 -            this.map = new HashMap<String, L[]>();
    9.84 -        }
    9.85 -        L[] array = this.map.get(name);
    9.86 -        int size = (array != null)
    9.87 -                ? array.length
    9.88 -                : 0;
    9.89 -
    9.90 -        L[] clone = newArray(size + 1);
    9.91 -        clone[size] = listener;
    9.92 -        if (array != null) {
    9.93 -            System.arraycopy(array, 0, clone, 0, size);
    9.94 -        }
    9.95 -        this.map.put(name, clone);
    9.96 -    }
    9.97 -
    9.98 -    /**
    9.99 -     * Removes a listener from the list of listeners for the specified property.
   9.100 -     * If the listener was added more than once to the same event source,
   9.101 -     * this listener will be notified one less time after being removed.
   9.102 -     *
   9.103 -     * @param name      the name of the property to listen on
   9.104 -     * @param listener  the listener to process events
   9.105 -     */
   9.106 -    public final synchronized void remove(String name, L listener) {
   9.107 -        if (this.map != null) {
   9.108 -            L[] array = this.map.get(name);
   9.109 -            if (array != null) {
   9.110 -                for (int i = 0; i < array.length; i++) {
   9.111 -                    if (listener.equals(array[i])) {
   9.112 -                        int size = array.length - 1;
   9.113 -                        if (size > 0) {
   9.114 -                            L[] clone = newArray(size);
   9.115 -                            System.arraycopy(array, 0, clone, 0, i);
   9.116 -                            System.arraycopy(array, i + 1, clone, i, size - i);
   9.117 -                            this.map.put(name, clone);
   9.118 -                        }
   9.119 -                        else {
   9.120 -                            this.map.remove(name);
   9.121 -                            if (this.map.isEmpty()) {
   9.122 -                                this.map = null;
   9.123 -                            }
   9.124 -                        }
   9.125 -                        break;
   9.126 -                    }
   9.127 -                }
   9.128 -            }
   9.129 -        }
   9.130 -    }
   9.131 -
   9.132 -    /**
   9.133 -     * Returns the list of listeners for the specified property.
   9.134 -     *
   9.135 -     * @param name  the name of the property
   9.136 -     * @return      the corresponding list of listeners
   9.137 -     */
   9.138 -    public final synchronized L[] get(String name) {
   9.139 -        return (this.map != null)
   9.140 -                ? this.map.get(name)
   9.141 -                : null;
   9.142 -    }
   9.143 -
   9.144 -    /**
   9.145 -     * Sets new list of listeners for the specified property.
   9.146 -     *
   9.147 -     * @param name       the name of the property
   9.148 -     * @param listeners  new list of listeners
   9.149 -     */
   9.150 -    public final void set(String name, L[] listeners) {
   9.151 -        if (listeners != null) {
   9.152 -            if (this.map == null) {
   9.153 -                this.map = new HashMap<String, L[]>();
   9.154 -            }
   9.155 -            this.map.put(name, listeners);
   9.156 -        }
   9.157 -        else if (this.map != null) {
   9.158 -            this.map.remove(name);
   9.159 -            if (this.map.isEmpty()) {
   9.160 -                this.map = null;
   9.161 -            }
   9.162 -        }
   9.163 -    }
   9.164 -
   9.165 -    /**
   9.166 -     * Returns all listeners in the map.
   9.167 -     *
   9.168 -     * @return an array of all listeners
   9.169 -     */
   9.170 -    public final synchronized L[] getListeners() {
   9.171 -        if (this.map == null) {
   9.172 -            return newArray(0);
   9.173 -        }
   9.174 -        List<L> list = new ArrayList<L>();
   9.175 -
   9.176 -        L[] listeners = this.map.get(null);
   9.177 -        if (listeners != null) {
   9.178 -            for (L listener : listeners) {
   9.179 -                list.add(listener);
   9.180 -            }
   9.181 -        }
   9.182 -        for (Entry<String, L[]> entry : this.map.entrySet()) {
   9.183 -            String name = entry.getKey();
   9.184 -            if (name != null) {
   9.185 -                for (L listener : entry.getValue()) {
   9.186 -                    list.add(newProxy(name, listener));
   9.187 -                }
   9.188 -            }
   9.189 -        }
   9.190 -        return list.toArray(newArray(list.size()));
   9.191 -    }
   9.192 -
   9.193 -    /**
   9.194 -     * Returns listeners that have been associated with the named property.
   9.195 -     *
   9.196 -     * @param name  the name of the property
   9.197 -     * @return an array of listeners for the named property
   9.198 -     */
   9.199 -    public final L[] getListeners(String name) {
   9.200 -        if (name != null) {
   9.201 -            L[] listeners = get(name);
   9.202 -            if (listeners != null) {
   9.203 -                return listeners.clone();
   9.204 -            }
   9.205 -        }
   9.206 -        return newArray(0);
   9.207 -    }
   9.208 -
   9.209 -    /**
   9.210 -     * Indicates whether the map contains
   9.211 -     * at least one listener to be notified.
   9.212 -     *
   9.213 -     * @param name  the name of the property
   9.214 -     * @return      {@code true} if at least one listener exists or
   9.215 -     *              {@code false} otherwise
   9.216 -     */
   9.217 -    public final synchronized boolean hasListeners(String name) {
   9.218 -        if (this.map == null) {
   9.219 -            return false;
   9.220 -        }
   9.221 -        L[] array = this.map.get(null);
   9.222 -        return (array != null) || ((name != null) && (null != this.map.get(name)));
   9.223 -    }
   9.224 -
   9.225 -    /**
   9.226 -     * Returns a set of entries from the map.
   9.227 -     * Each entry is a pair consisted of the property name
   9.228 -     * and the corresponding list of listeners.
   9.229 -     *
   9.230 -     * @return a set of entries from the map
   9.231 -     */
   9.232 -    public final Set<Entry<String, L[]>> getEntries() {
   9.233 -        return (this.map != null)
   9.234 -                ? this.map.entrySet()
   9.235 -                : Collections.<Entry<String, L[]>>emptySet();
   9.236 -    }
   9.237 -
   9.238 -    /**
   9.239 -     * Extracts a real listener from the proxy listener.
   9.240 -     * It is necessary because default proxy class is not serializable.
   9.241 -     *
   9.242 -     * @return a real listener
   9.243 -     */
   9.244 -    public final L extract(L listener) {
   9.245 -        while (listener instanceof EventListenerProxy) {
   9.246 -            EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener;
   9.247 -            listener = proxy.getListener();
   9.248 -        }
   9.249 -        return listener;
   9.250 -    }
   9.251 -}
    10.1 --- a/emul/compact/src/main/java/java/beans/IndexedPropertyChangeEvent.java	Mon Feb 25 19:00:08 2013 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,78 +0,0 @@
    10.4 -/*
    10.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    10.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 - *
    10.8 - * This code is free software; you can redistribute it and/or modify it
    10.9 - * under the terms of the GNU General Public License version 2 only, as
   10.10 - * published by the Free Software Foundation.  Oracle designates this
   10.11 - * particular file as subject to the "Classpath" exception as provided
   10.12 - * by Oracle in the LICENSE file that accompanied this code.
   10.13 - *
   10.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   10.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.17 - * version 2 for more details (a copy is included in the LICENSE file that
   10.18 - * accompanied this code).
   10.19 - *
   10.20 - * You should have received a copy of the GNU General Public License version
   10.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   10.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.23 - *
   10.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.25 - * or visit www.oracle.com if you need additional information or have any
   10.26 - * questions.
   10.27 - */
   10.28 -package java.beans;
   10.29 -
   10.30 -/**
   10.31 - * An "IndexedPropertyChange" event gets delivered whenever a component that
   10.32 - * conforms to the JavaBeans&trade; specification (a "bean") changes a bound
   10.33 - * indexed property. This class is an extension of <code>PropertyChangeEvent</code>
   10.34 - * but contains the index of the property that has changed.
   10.35 - * <P>
   10.36 - * Null values may be provided for the old and the new values if their
   10.37 - * true values are not known.
   10.38 - * <P>
   10.39 - * An event source may send a null object as the name to indicate that an
   10.40 - * arbitrary set of if its properties have changed.  In this case the
   10.41 - * old and new values should also be null.
   10.42 - *
   10.43 - * @since 1.5
   10.44 - * @author Mark Davidson
   10.45 - */
   10.46 -public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
   10.47 -    private static final long serialVersionUID = -320227448495806870L;
   10.48 -
   10.49 -    private int index;
   10.50 -
   10.51 -    /**
   10.52 -     * Constructs a new <code>IndexedPropertyChangeEvent</code> object.
   10.53 -     *
   10.54 -     * @param source  The bean that fired the event.
   10.55 -     * @param propertyName  The programmatic name of the property that
   10.56 -     *             was changed.
   10.57 -     * @param oldValue      The old value of the property.
   10.58 -     * @param newValue      The new value of the property.
   10.59 -     * @param index index of the property element that was changed.
   10.60 -     */
   10.61 -    public IndexedPropertyChangeEvent(Object source, String propertyName,
   10.62 -                                      Object oldValue, Object newValue,
   10.63 -                                      int index) {
   10.64 -        super (source, propertyName, oldValue, newValue);
   10.65 -        this.index = index;
   10.66 -    }
   10.67 -
   10.68 -    /**
   10.69 -     * Gets the index of the property that was changed.
   10.70 -     *
   10.71 -     * @return The index specifying the property element that was
   10.72 -     *         changed.
   10.73 -     */
   10.74 -    public int getIndex() {
   10.75 -        return index;
   10.76 -    }
   10.77 -
   10.78 -    void appendTo(StringBuilder sb) {
   10.79 -        sb.append("; index=").append(getIndex());
   10.80 -    }
   10.81 -}
    11.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeEvent.java	Mon Feb 25 19:00:08 2013 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,164 +0,0 @@
    11.4 -/*
    11.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    11.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 - *
    11.8 - * This code is free software; you can redistribute it and/or modify it
    11.9 - * under the terms of the GNU General Public License version 2 only, as
   11.10 - * published by the Free Software Foundation.  Oracle designates this
   11.11 - * particular file as subject to the "Classpath" exception as provided
   11.12 - * by Oracle in the LICENSE file that accompanied this code.
   11.13 - *
   11.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   11.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.17 - * version 2 for more details (a copy is included in the LICENSE file that
   11.18 - * accompanied this code).
   11.19 - *
   11.20 - * You should have received a copy of the GNU General Public License version
   11.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   11.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.23 - *
   11.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.25 - * or visit www.oracle.com if you need additional information or have any
   11.26 - * questions.
   11.27 - */
   11.28 -
   11.29 -package java.beans;
   11.30 -
   11.31 -/**
   11.32 - * A "PropertyChange" event gets delivered whenever a bean changes a "bound"
   11.33 - * or "constrained" property.  A PropertyChangeEvent object is sent as an
   11.34 - * argument to the PropertyChangeListener and VetoableChangeListener methods.
   11.35 - * <P>
   11.36 - * Normally PropertyChangeEvents are accompanied by the name and the old
   11.37 - * and new value of the changed property.  If the new value is a primitive
   11.38 - * type (such as int or boolean) it must be wrapped as the
   11.39 - * corresponding java.lang.* Object type (such as Integer or Boolean).
   11.40 - * <P>
   11.41 - * Null values may be provided for the old and the new values if their
   11.42 - * true values are not known.
   11.43 - * <P>
   11.44 - * An event source may send a null object as the name to indicate that an
   11.45 - * arbitrary set of if its properties have changed.  In this case the
   11.46 - * old and new values should also be null.
   11.47 - */
   11.48 -
   11.49 -public class PropertyChangeEvent extends java.util.EventObject {
   11.50 -    private static final long serialVersionUID = 7042693688939648123L;
   11.51 -
   11.52 -    /**
   11.53 -     * Constructs a new <code>PropertyChangeEvent</code>.
   11.54 -     *
   11.55 -     * @param source  The bean that fired the event.
   11.56 -     * @param propertyName  The programmatic name of the property
   11.57 -     *          that was changed.
   11.58 -     * @param oldValue  The old value of the property.
   11.59 -     * @param newValue  The new value of the property.
   11.60 -     */
   11.61 -    public PropertyChangeEvent(Object source, String propertyName,
   11.62 -                                     Object oldValue, Object newValue) {
   11.63 -        super(source);
   11.64 -        this.propertyName = propertyName;
   11.65 -        this.newValue = newValue;
   11.66 -        this.oldValue = oldValue;
   11.67 -    }
   11.68 -
   11.69 -    /**
   11.70 -     * Gets the programmatic name of the property that was changed.
   11.71 -     *
   11.72 -     * @return  The programmatic name of the property that was changed.
   11.73 -     *          May be null if multiple properties have changed.
   11.74 -     */
   11.75 -    public String getPropertyName() {
   11.76 -        return propertyName;
   11.77 -    }
   11.78 -
   11.79 -    /**
   11.80 -     * Gets the new value for the property, expressed as an Object.
   11.81 -     *
   11.82 -     * @return  The new value for the property, expressed as an Object.
   11.83 -     *          May be null if multiple properties have changed.
   11.84 -     */
   11.85 -    public Object getNewValue() {
   11.86 -        return newValue;
   11.87 -    }
   11.88 -
   11.89 -    /**
   11.90 -     * Gets the old value for the property, expressed as an Object.
   11.91 -     *
   11.92 -     * @return  The old value for the property, expressed as an Object.
   11.93 -     *          May be null if multiple properties have changed.
   11.94 -     */
   11.95 -    public Object getOldValue() {
   11.96 -        return oldValue;
   11.97 -    }
   11.98 -
   11.99 -    /**
  11.100 -     * Sets the propagationId object for the event.
  11.101 -     *
  11.102 -     * @param propagationId  The propagationId object for the event.
  11.103 -     */
  11.104 -    public void setPropagationId(Object propagationId) {
  11.105 -        this.propagationId = propagationId;
  11.106 -    }
  11.107 -
  11.108 -    /**
  11.109 -     * The "propagationId" field is reserved for future use.  In Beans 1.0
  11.110 -     * the sole requirement is that if a listener catches a PropertyChangeEvent
  11.111 -     * and then fires a PropertyChangeEvent of its own, then it should
  11.112 -     * make sure that it propagates the propagationId field from its
  11.113 -     * incoming event to its outgoing event.
  11.114 -     *
  11.115 -     * @return the propagationId object associated with a bound/constrained
  11.116 -     *          property update.
  11.117 -     */
  11.118 -    public Object getPropagationId() {
  11.119 -        return propagationId;
  11.120 -    }
  11.121 -
  11.122 -    /**
  11.123 -     * name of the property that changed.  May be null, if not known.
  11.124 -     * @serial
  11.125 -     */
  11.126 -    private String propertyName;
  11.127 -
  11.128 -    /**
  11.129 -     * New value for property.  May be null if not known.
  11.130 -     * @serial
  11.131 -     */
  11.132 -    private Object newValue;
  11.133 -
  11.134 -    /**
  11.135 -     * Previous value for property.  May be null if not known.
  11.136 -     * @serial
  11.137 -     */
  11.138 -    private Object oldValue;
  11.139 -
  11.140 -    /**
  11.141 -     * Propagation ID.  May be null.
  11.142 -     * @serial
  11.143 -     * @see #getPropagationId
  11.144 -     */
  11.145 -    private Object propagationId;
  11.146 -
  11.147 -    /**
  11.148 -     * Returns a string representation of the object.
  11.149 -     *
  11.150 -     * @return a string representation of the object
  11.151 -     *
  11.152 -     * @since 1.7
  11.153 -     */
  11.154 -    public String toString() {
  11.155 -        StringBuilder sb = new StringBuilder(getClass().getName());
  11.156 -        sb.append("[propertyName=").append(getPropertyName());
  11.157 -        appendTo(sb);
  11.158 -        sb.append("; oldValue=").append(getOldValue());
  11.159 -        sb.append("; newValue=").append(getNewValue());
  11.160 -        sb.append("; propagationId=").append(getPropagationId());
  11.161 -        sb.append("; source=").append(getSource());
  11.162 -        return sb.append("]").toString();
  11.163 -    }
  11.164 -
  11.165 -    void appendTo(StringBuilder sb) {
  11.166 -    }
  11.167 -}
    12.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeListener.java	Mon Feb 25 19:00:08 2013 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,44 +0,0 @@
    12.4 -/*
    12.5 - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
    12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 - *
    12.8 - * This code is free software; you can redistribute it and/or modify it
    12.9 - * under the terms of the GNU General Public License version 2 only, as
   12.10 - * published by the Free Software Foundation.  Oracle designates this
   12.11 - * particular file as subject to the "Classpath" exception as provided
   12.12 - * by Oracle in the LICENSE file that accompanied this code.
   12.13 - *
   12.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 - * version 2 for more details (a copy is included in the LICENSE file that
   12.18 - * accompanied this code).
   12.19 - *
   12.20 - * You should have received a copy of the GNU General Public License version
   12.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   12.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 - *
   12.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 - * or visit www.oracle.com if you need additional information or have any
   12.26 - * questions.
   12.27 - */
   12.28 -
   12.29 -package java.beans;
   12.30 -
   12.31 -/**
   12.32 - * A "PropertyChange" event gets fired whenever a bean changes a "bound"
   12.33 - * property.  You can register a PropertyChangeListener with a source
   12.34 - * bean so as to be notified of any bound property updates.
   12.35 - */
   12.36 -
   12.37 -public interface PropertyChangeListener extends java.util.EventListener {
   12.38 -
   12.39 -    /**
   12.40 -     * This method gets called when a bound property is changed.
   12.41 -     * @param evt A PropertyChangeEvent object describing the event source
   12.42 -     *          and the property that has changed.
   12.43 -     */
   12.44 -
   12.45 -    void propertyChange(PropertyChangeEvent evt);
   12.46 -
   12.47 -}
    13.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeListenerProxy.java	Mon Feb 25 19:00:08 2013 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,81 +0,0 @@
    13.4 -/*
    13.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
    13.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 - *
    13.8 - * This code is free software; you can redistribute it and/or modify it
    13.9 - * under the terms of the GNU General Public License version 2 only, as
   13.10 - * published by the Free Software Foundation.  Oracle designates this
   13.11 - * particular file as subject to the "Classpath" exception as provided
   13.12 - * by Oracle in the LICENSE file that accompanied this code.
   13.13 - *
   13.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   13.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.17 - * version 2 for more details (a copy is included in the LICENSE file that
   13.18 - * accompanied this code).
   13.19 - *
   13.20 - * You should have received a copy of the GNU General Public License version
   13.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   13.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.23 - *
   13.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.25 - * or visit www.oracle.com if you need additional information or have any
   13.26 - * questions.
   13.27 - */
   13.28 -
   13.29 -package java.beans;
   13.30 -
   13.31 -import java.util.EventListenerProxy;
   13.32 -
   13.33 -/**
   13.34 - * A class which extends the {@code EventListenerProxy}
   13.35 - * specifically for adding a {@code PropertyChangeListener}
   13.36 - * with a "bound" property.
   13.37 - * Instances of this class can be added
   13.38 - * as {@code PropertyChangeListener}s to a bean
   13.39 - * which supports firing property change events.
   13.40 - * <p>
   13.41 - * If the object has a {@code getPropertyChangeListeners} method
   13.42 - * then the array returned could be a mixture of {@code PropertyChangeListener}
   13.43 - * and {@code PropertyChangeListenerProxy} objects.
   13.44 - *
   13.45 - * @see java.util.EventListenerProxy
   13.46 - * @see PropertyChangeSupport#getPropertyChangeListeners
   13.47 - * @since 1.4
   13.48 - */
   13.49 -public class PropertyChangeListenerProxy
   13.50 -        extends EventListenerProxy<PropertyChangeListener>
   13.51 -        implements PropertyChangeListener {
   13.52 -
   13.53 -    private final String propertyName;
   13.54 -
   13.55 -    /**
   13.56 -     * Constructor which binds the {@code PropertyChangeListener}
   13.57 -     * to a specific property.
   13.58 -     *
   13.59 -     * @param propertyName  the name of the property to listen on
   13.60 -     * @param listener      the listener object
   13.61 -     */
   13.62 -    public PropertyChangeListenerProxy(String propertyName, PropertyChangeListener listener) {
   13.63 -        super(listener);
   13.64 -        this.propertyName = propertyName;
   13.65 -    }
   13.66 -
   13.67 -    /**
   13.68 -     * Forwards the property change event to the listener delegate.
   13.69 -     *
   13.70 -     * @param event  the property change event
   13.71 -     */
   13.72 -    public void propertyChange(PropertyChangeEvent event) {
   13.73 -        getListener().propertyChange(event);
   13.74 -    }
   13.75 -
   13.76 -    /**
   13.77 -     * Returns the name of the named property associated with the listener.
   13.78 -     *
   13.79 -     * @return the name of the named property associated with the listener
   13.80 -     */
   13.81 -    public String getPropertyName() {
   13.82 -        return this.propertyName;
   13.83 -    }
   13.84 -}
    14.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeSupport.java	Mon Feb 25 19:00:08 2013 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,536 +0,0 @@
    14.4 -/*
    14.5 - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
    14.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 - *
    14.8 - * This code is free software; you can redistribute it and/or modify it
    14.9 - * under the terms of the GNU General Public License version 2 only, as
   14.10 - * published by the Free Software Foundation.  Oracle designates this
   14.11 - * particular file as subject to the "Classpath" exception as provided
   14.12 - * by Oracle in the LICENSE file that accompanied this code.
   14.13 - *
   14.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   14.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.17 - * version 2 for more details (a copy is included in the LICENSE file that
   14.18 - * accompanied this code).
   14.19 - *
   14.20 - * You should have received a copy of the GNU General Public License version
   14.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   14.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.23 - *
   14.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.25 - * or visit www.oracle.com if you need additional information or have any
   14.26 - * questions.
   14.27 - */
   14.28 -package java.beans;
   14.29 -
   14.30 -import java.io.Serializable;
   14.31 -import java.io.ObjectStreamField;
   14.32 -import java.io.ObjectOutputStream;
   14.33 -import java.io.ObjectInputStream;
   14.34 -import java.io.IOException;
   14.35 -import java.util.Hashtable;
   14.36 -import java.util.Map.Entry;
   14.37 -
   14.38 -/**
   14.39 - * This is a utility class that can be used by beans that support bound
   14.40 - * properties.  It manages a list of listeners and dispatches
   14.41 - * {@link PropertyChangeEvent}s to them.  You can use an instance of this class
   14.42 - * as a member field of your bean and delegate these types of work to it.
   14.43 - * The {@link PropertyChangeListener} can be registered for all properties
   14.44 - * or for a property specified by name.
   14.45 - * <p>
   14.46 - * Here is an example of {@code PropertyChangeSupport} usage that follows
   14.47 - * the rules and recommendations laid out in the JavaBeans&trade; specification:
   14.48 - * <pre>
   14.49 - * public class MyBean {
   14.50 - *     private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
   14.51 - *
   14.52 - *     public void addPropertyChangeListener(PropertyChangeListener listener) {
   14.53 - *         this.pcs.addPropertyChangeListener(listener);
   14.54 - *     }
   14.55 - *
   14.56 - *     public void removePropertyChangeListener(PropertyChangeListener listener) {
   14.57 - *         this.pcs.removePropertyChangeListener(listener);
   14.58 - *     }
   14.59 - *
   14.60 - *     private String value;
   14.61 - *
   14.62 - *     public String getValue() {
   14.63 - *         return this.value;
   14.64 - *     }
   14.65 - *
   14.66 - *     public void setValue(String newValue) {
   14.67 - *         String oldValue = this.value;
   14.68 - *         this.value = newValue;
   14.69 - *         this.pcs.firePropertyChange("value", oldValue, newValue);
   14.70 - *     }
   14.71 - *
   14.72 - *     [...]
   14.73 - * }
   14.74 - * </pre>
   14.75 - * <p>
   14.76 - * A {@code PropertyChangeSupport} instance is thread-safe.
   14.77 - * <p>
   14.78 - * This class is serializable.  When it is serialized it will save
   14.79 - * (and restore) any listeners that are themselves serializable.  Any
   14.80 - * non-serializable listeners will be skipped during serialization.
   14.81 - *
   14.82 - * @see VetoableChangeSupport
   14.83 - */
   14.84 -public class PropertyChangeSupport implements Serializable {
   14.85 -    private PropertyChangeListenerMap map = new PropertyChangeListenerMap();
   14.86 -
   14.87 -    /**
   14.88 -     * Constructs a <code>PropertyChangeSupport</code> object.
   14.89 -     *
   14.90 -     * @param sourceBean  The bean to be given as the source for any events.
   14.91 -     */
   14.92 -    public PropertyChangeSupport(Object sourceBean) {
   14.93 -        if (sourceBean == null) {
   14.94 -            throw new NullPointerException();
   14.95 -        }
   14.96 -        source = sourceBean;
   14.97 -    }
   14.98 -
   14.99 -    /**
  14.100 -     * Add a PropertyChangeListener to the listener list.
  14.101 -     * The listener is registered for all properties.
  14.102 -     * The same listener object may be added more than once, and will be called
  14.103 -     * as many times as it is added.
  14.104 -     * If <code>listener</code> is null, no exception is thrown and no action
  14.105 -     * is taken.
  14.106 -     *
  14.107 -     * @param listener  The PropertyChangeListener to be added
  14.108 -     */
  14.109 -    public void addPropertyChangeListener(PropertyChangeListener listener) {
  14.110 -        if (listener == null) {
  14.111 -            return;
  14.112 -        }
  14.113 -        if (listener instanceof PropertyChangeListenerProxy) {
  14.114 -            PropertyChangeListenerProxy proxy =
  14.115 -                   (PropertyChangeListenerProxy)listener;
  14.116 -            // Call two argument add method.
  14.117 -            addPropertyChangeListener(proxy.getPropertyName(),
  14.118 -                                      proxy.getListener());
  14.119 -        } else {
  14.120 -            this.map.add(null, listener);
  14.121 -        }
  14.122 -    }
  14.123 -
  14.124 -    /**
  14.125 -     * Remove a PropertyChangeListener from the listener list.
  14.126 -     * This removes a PropertyChangeListener that was registered
  14.127 -     * for all properties.
  14.128 -     * If <code>listener</code> was added more than once to the same event
  14.129 -     * source, it will be notified one less time after being removed.
  14.130 -     * If <code>listener</code> is null, or was never added, no exception is
  14.131 -     * thrown and no action is taken.
  14.132 -     *
  14.133 -     * @param listener  The PropertyChangeListener to be removed
  14.134 -     */
  14.135 -    public void removePropertyChangeListener(PropertyChangeListener listener) {
  14.136 -        if (listener == null) {
  14.137 -            return;
  14.138 -        }
  14.139 -        if (listener instanceof PropertyChangeListenerProxy) {
  14.140 -            PropertyChangeListenerProxy proxy =
  14.141 -                    (PropertyChangeListenerProxy)listener;
  14.142 -            // Call two argument remove method.
  14.143 -            removePropertyChangeListener(proxy.getPropertyName(),
  14.144 -                                         proxy.getListener());
  14.145 -        } else {
  14.146 -            this.map.remove(null, listener);
  14.147 -        }
  14.148 -    }
  14.149 -
  14.150 -    /**
  14.151 -     * Returns an array of all the listeners that were added to the
  14.152 -     * PropertyChangeSupport object with addPropertyChangeListener().
  14.153 -     * <p>
  14.154 -     * If some listeners have been added with a named property, then
  14.155 -     * the returned array will be a mixture of PropertyChangeListeners
  14.156 -     * and <code>PropertyChangeListenerProxy</code>s. If the calling
  14.157 -     * method is interested in distinguishing the listeners then it must
  14.158 -     * test each element to see if it's a
  14.159 -     * <code>PropertyChangeListenerProxy</code>, perform the cast, and examine
  14.160 -     * the parameter.
  14.161 -     *
  14.162 -     * <pre>
  14.163 -     * PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
  14.164 -     * for (int i = 0; i < listeners.length; i++) {
  14.165 -     *   if (listeners[i] instanceof PropertyChangeListenerProxy) {
  14.166 -     *     PropertyChangeListenerProxy proxy =
  14.167 -     *                    (PropertyChangeListenerProxy)listeners[i];
  14.168 -     *     if (proxy.getPropertyName().equals("foo")) {
  14.169 -     *       // proxy is a PropertyChangeListener which was associated
  14.170 -     *       // with the property named "foo"
  14.171 -     *     }
  14.172 -     *   }
  14.173 -     * }
  14.174 -     *</pre>
  14.175 -     *
  14.176 -     * @see PropertyChangeListenerProxy
  14.177 -     * @return all of the <code>PropertyChangeListeners</code> added or an
  14.178 -     *         empty array if no listeners have been added
  14.179 -     * @since 1.4
  14.180 -     */
  14.181 -    public PropertyChangeListener[] getPropertyChangeListeners() {
  14.182 -        return this.map.getListeners();
  14.183 -    }
  14.184 -
  14.185 -    /**
  14.186 -     * Add a PropertyChangeListener for a specific property.  The listener
  14.187 -     * will be invoked only when a call on firePropertyChange names that
  14.188 -     * specific property.
  14.189 -     * The same listener object may be added more than once.  For each
  14.190 -     * property,  the listener will be invoked the number of times it was added
  14.191 -     * for that property.
  14.192 -     * If <code>propertyName</code> or <code>listener</code> is null, no
  14.193 -     * exception is thrown and no action is taken.
  14.194 -     *
  14.195 -     * @param propertyName  The name of the property to listen on.
  14.196 -     * @param listener  The PropertyChangeListener to be added
  14.197 -     */
  14.198 -    public void addPropertyChangeListener(
  14.199 -                String propertyName,
  14.200 -                PropertyChangeListener listener) {
  14.201 -        if (listener == null || propertyName == null) {
  14.202 -            return;
  14.203 -        }
  14.204 -        listener = this.map.extract(listener);
  14.205 -        if (listener != null) {
  14.206 -            this.map.add(propertyName, listener);
  14.207 -        }
  14.208 -    }
  14.209 -
  14.210 -    /**
  14.211 -     * Remove a PropertyChangeListener for a specific property.
  14.212 -     * If <code>listener</code> was added more than once to the same event
  14.213 -     * source for the specified property, it will be notified one less time
  14.214 -     * after being removed.
  14.215 -     * If <code>propertyName</code> is null,  no exception is thrown and no
  14.216 -     * action is taken.
  14.217 -     * If <code>listener</code> is null, or was never added for the specified
  14.218 -     * property, no exception is thrown and no action is taken.
  14.219 -     *
  14.220 -     * @param propertyName  The name of the property that was listened on.
  14.221 -     * @param listener  The PropertyChangeListener to be removed
  14.222 -     */
  14.223 -    public void removePropertyChangeListener(
  14.224 -                String propertyName,
  14.225 -                PropertyChangeListener listener) {
  14.226 -        if (listener == null || propertyName == null) {
  14.227 -            return;
  14.228 -        }
  14.229 -        listener = this.map.extract(listener);
  14.230 -        if (listener != null) {
  14.231 -            this.map.remove(propertyName, listener);
  14.232 -        }
  14.233 -    }
  14.234 -
  14.235 -    /**
  14.236 -     * Returns an array of all the listeners which have been associated
  14.237 -     * with the named property.
  14.238 -     *
  14.239 -     * @param propertyName  The name of the property being listened to
  14.240 -     * @return all of the <code>PropertyChangeListeners</code> associated with
  14.241 -     *         the named property.  If no such listeners have been added,
  14.242 -     *         or if <code>propertyName</code> is null, an empty array is
  14.243 -     *         returned.
  14.244 -     * @since 1.4
  14.245 -     */
  14.246 -    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
  14.247 -        return this.map.getListeners(propertyName);
  14.248 -    }
  14.249 -
  14.250 -    /**
  14.251 -     * Reports a bound property update to listeners
  14.252 -     * that have been registered to track updates of
  14.253 -     * all properties or a property with the specified name.
  14.254 -     * <p>
  14.255 -     * No event is fired if old and new values are equal and non-null.
  14.256 -     * <p>
  14.257 -     * This is merely a convenience wrapper around the more general
  14.258 -     * {@link #firePropertyChange(PropertyChangeEvent)} method.
  14.259 -     *
  14.260 -     * @param propertyName  the programmatic name of the property that was changed
  14.261 -     * @param oldValue      the old value of the property
  14.262 -     * @param newValue      the new value of the property
  14.263 -     */
  14.264 -    public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
  14.265 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  14.266 -            firePropertyChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
  14.267 -        }
  14.268 -    }
  14.269 -
  14.270 -    /**
  14.271 -     * Reports an integer bound property update to listeners
  14.272 -     * that have been registered to track updates of
  14.273 -     * all properties or a property with the specified name.
  14.274 -     * <p>
  14.275 -     * No event is fired if old and new values are equal.
  14.276 -     * <p>
  14.277 -     * This is merely a convenience wrapper around the more general
  14.278 -     * {@link #firePropertyChange(String, Object, Object)}  method.
  14.279 -     *
  14.280 -     * @param propertyName  the programmatic name of the property that was changed
  14.281 -     * @param oldValue      the old value of the property
  14.282 -     * @param newValue      the new value of the property
  14.283 -     */
  14.284 -    public void firePropertyChange(String propertyName, int oldValue, int newValue) {
  14.285 -        if (oldValue != newValue) {
  14.286 -            firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  14.287 -        }
  14.288 -    }
  14.289 -
  14.290 -    /**
  14.291 -     * Reports a boolean bound property update to listeners
  14.292 -     * that have been registered to track updates of
  14.293 -     * all properties or a property with the specified name.
  14.294 -     * <p>
  14.295 -     * No event is fired if old and new values are equal.
  14.296 -     * <p>
  14.297 -     * This is merely a convenience wrapper around the more general
  14.298 -     * {@link #firePropertyChange(String, Object, Object)}  method.
  14.299 -     *
  14.300 -     * @param propertyName  the programmatic name of the property that was changed
  14.301 -     * @param oldValue      the old value of the property
  14.302 -     * @param newValue      the new value of the property
  14.303 -     */
  14.304 -    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
  14.305 -        if (oldValue != newValue) {
  14.306 -            firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  14.307 -        }
  14.308 -    }
  14.309 -
  14.310 -    /**
  14.311 -     * Fires a property change event to listeners
  14.312 -     * that have been registered to track updates of
  14.313 -     * all properties or a property with the specified name.
  14.314 -     * <p>
  14.315 -     * No event is fired if the given event's old and new values are equal and non-null.
  14.316 -     *
  14.317 -     * @param event  the {@code PropertyChangeEvent} to be fired
  14.318 -     */
  14.319 -    public void firePropertyChange(PropertyChangeEvent event) {
  14.320 -        Object oldValue = event.getOldValue();
  14.321 -        Object newValue = event.getNewValue();
  14.322 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  14.323 -            String name = event.getPropertyName();
  14.324 -
  14.325 -            PropertyChangeListener[] common = this.map.get(null);
  14.326 -            PropertyChangeListener[] named = (name != null)
  14.327 -                        ? this.map.get(name)
  14.328 -                        : null;
  14.329 -
  14.330 -            fire(common, event);
  14.331 -            fire(named, event);
  14.332 -        }
  14.333 -    }
  14.334 -
  14.335 -    private static void fire(PropertyChangeListener[] listeners, PropertyChangeEvent event) {
  14.336 -        if (listeners != null) {
  14.337 -            for (PropertyChangeListener listener : listeners) {
  14.338 -                listener.propertyChange(event);
  14.339 -            }
  14.340 -        }
  14.341 -    }
  14.342 -
  14.343 -    /**
  14.344 -     * Reports a bound indexed property update to listeners
  14.345 -     * that have been registered to track updates of
  14.346 -     * all properties or a property with the specified name.
  14.347 -     * <p>
  14.348 -     * No event is fired if old and new values are equal and non-null.
  14.349 -     * <p>
  14.350 -     * This is merely a convenience wrapper around the more general
  14.351 -     * {@link #firePropertyChange(PropertyChangeEvent)} method.
  14.352 -     *
  14.353 -     * @param propertyName  the programmatic name of the property that was changed
  14.354 -     * @param index         the index of the property element that was changed
  14.355 -     * @param oldValue      the old value of the property
  14.356 -     * @param newValue      the new value of the property
  14.357 -     * @since 1.5
  14.358 -     */
  14.359 -    public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) {
  14.360 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  14.361 -            firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index));
  14.362 -        }
  14.363 -    }
  14.364 -
  14.365 -    /**
  14.366 -     * Reports an integer bound indexed property update to listeners
  14.367 -     * that have been registered to track updates of
  14.368 -     * all properties or a property with the specified name.
  14.369 -     * <p>
  14.370 -     * No event is fired if old and new values are equal.
  14.371 -     * <p>
  14.372 -     * This is merely a convenience wrapper around the more general
  14.373 -     * {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
  14.374 -     *
  14.375 -     * @param propertyName  the programmatic name of the property that was changed
  14.376 -     * @param index         the index of the property element that was changed
  14.377 -     * @param oldValue      the old value of the property
  14.378 -     * @param newValue      the new value of the property
  14.379 -     * @since 1.5
  14.380 -     */
  14.381 -    public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue) {
  14.382 -        if (oldValue != newValue) {
  14.383 -            fireIndexedPropertyChange(propertyName, index, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  14.384 -        }
  14.385 -    }
  14.386 -
  14.387 -    /**
  14.388 -     * Reports a boolean bound indexed property update to listeners
  14.389 -     * that have been registered to track updates of
  14.390 -     * all properties or a property with the specified name.
  14.391 -     * <p>
  14.392 -     * No event is fired if old and new values are equal.
  14.393 -     * <p>
  14.394 -     * This is merely a convenience wrapper around the more general
  14.395 -     * {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
  14.396 -     *
  14.397 -     * @param propertyName  the programmatic name of the property that was changed
  14.398 -     * @param index         the index of the property element that was changed
  14.399 -     * @param oldValue      the old value of the property
  14.400 -     * @param newValue      the new value of the property
  14.401 -     * @since 1.5
  14.402 -     */
  14.403 -    public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue) {
  14.404 -        if (oldValue != newValue) {
  14.405 -            fireIndexedPropertyChange(propertyName, index, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  14.406 -        }
  14.407 -    }
  14.408 -
  14.409 -    /**
  14.410 -     * Check if there are any listeners for a specific property, including
  14.411 -     * those registered on all properties.  If <code>propertyName</code>
  14.412 -     * is null, only check for listeners registered on all properties.
  14.413 -     *
  14.414 -     * @param propertyName  the property name.
  14.415 -     * @return true if there are one or more listeners for the given property
  14.416 -     */
  14.417 -    public boolean hasListeners(String propertyName) {
  14.418 -        return this.map.hasListeners(propertyName);
  14.419 -    }
  14.420 -
  14.421 -    /**
  14.422 -     * @serialData Null terminated list of <code>PropertyChangeListeners</code>.
  14.423 -     * <p>
  14.424 -     * At serialization time we skip non-serializable listeners and
  14.425 -     * only serialize the serializable listeners.
  14.426 -     */
  14.427 -    private void writeObject(ObjectOutputStream s) throws IOException {
  14.428 -        Hashtable<String, PropertyChangeSupport> children = null;
  14.429 -        PropertyChangeListener[] listeners = null;
  14.430 -        synchronized (this.map) {
  14.431 -            for (Entry<String, PropertyChangeListener[]> entry : this.map.getEntries()) {
  14.432 -                String property = entry.getKey();
  14.433 -                if (property == null) {
  14.434 -                    listeners = entry.getValue();
  14.435 -                } else {
  14.436 -                    if (children == null) {
  14.437 -                        children = new Hashtable<String, PropertyChangeSupport>();
  14.438 -                    }
  14.439 -                    PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
  14.440 -                    pcs.map.set(null, entry.getValue());
  14.441 -                    children.put(property, pcs);
  14.442 -                }
  14.443 -            }
  14.444 -        }
  14.445 -        ObjectOutputStream.PutField fields = s.putFields();
  14.446 -        fields.put("children", children);
  14.447 -        fields.put("source", this.source);
  14.448 -        fields.put("propertyChangeSupportSerializedDataVersion", 2);
  14.449 -        s.writeFields();
  14.450 -
  14.451 -        if (listeners != null) {
  14.452 -            for (PropertyChangeListener l : listeners) {
  14.453 -                if (l instanceof Serializable) {
  14.454 -                    s.writeObject(l);
  14.455 -                }
  14.456 -            }
  14.457 -        }
  14.458 -        s.writeObject(null);
  14.459 -    }
  14.460 -
  14.461 -    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
  14.462 -        this.map = new PropertyChangeListenerMap();
  14.463 -
  14.464 -        ObjectInputStream.GetField fields = s.readFields();
  14.465 -
  14.466 -        Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
  14.467 -        this.source = fields.get("source", null);
  14.468 -        fields.get("propertyChangeSupportSerializedDataVersion", 2);
  14.469 -
  14.470 -        Object listenerOrNull;
  14.471 -        while (null != (listenerOrNull = s.readObject())) {
  14.472 -            this.map.add(null, (PropertyChangeListener)listenerOrNull);
  14.473 -        }
  14.474 -        if (children != null) {
  14.475 -            for (Entry<String, PropertyChangeSupport> entry : children.entrySet()) {
  14.476 -                for (PropertyChangeListener listener : entry.getValue().getPropertyChangeListeners()) {
  14.477 -                    this.map.add(entry.getKey(), listener);
  14.478 -                }
  14.479 -            }
  14.480 -        }
  14.481 -    }
  14.482 -
  14.483 -    /**
  14.484 -     * The object to be provided as the "source" for any generated events.
  14.485 -     */
  14.486 -    private Object source;
  14.487 -
  14.488 -    /**
  14.489 -     * @serialField children                                   Hashtable
  14.490 -     * @serialField source                                     Object
  14.491 -     * @serialField propertyChangeSupportSerializedDataVersion int
  14.492 -     */
  14.493 -    private static final ObjectStreamField[] serialPersistentFields = {
  14.494 -            new ObjectStreamField("children", Hashtable.class),
  14.495 -            new ObjectStreamField("source", Object.class),
  14.496 -            new ObjectStreamField("propertyChangeSupportSerializedDataVersion", Integer.TYPE)
  14.497 -    };
  14.498 -
  14.499 -    /**
  14.500 -     * Serialization version ID, so we're compatible with JDK 1.1
  14.501 -     */
  14.502 -    static final long serialVersionUID = 6401253773779951803L;
  14.503 -
  14.504 -    /**
  14.505 -     * This is a {@link ChangeListenerMap ChangeListenerMap} implementation
  14.506 -     * that works with {@link PropertyChangeListener PropertyChangeListener} objects.
  14.507 -     */
  14.508 -    private static final class PropertyChangeListenerMap extends ChangeListenerMap<PropertyChangeListener> {
  14.509 -        private static final PropertyChangeListener[] EMPTY = {};
  14.510 -
  14.511 -        /**
  14.512 -         * Creates an array of {@link PropertyChangeListener PropertyChangeListener} objects.
  14.513 -         * This method uses the same instance of the empty array
  14.514 -         * when {@code length} equals {@code 0}.
  14.515 -         *
  14.516 -         * @param length  the array length
  14.517 -         * @return        an array with specified length
  14.518 -         */
  14.519 -        @Override
  14.520 -        protected PropertyChangeListener[] newArray(int length) {
  14.521 -            return (0 < length)
  14.522 -                    ? new PropertyChangeListener[length]
  14.523 -                    : EMPTY;
  14.524 -        }
  14.525 -
  14.526 -        /**
  14.527 -         * Creates a {@link PropertyChangeListenerProxy PropertyChangeListenerProxy}
  14.528 -         * object for the specified property.
  14.529 -         *
  14.530 -         * @param name      the name of the property to listen on
  14.531 -         * @param listener  the listener to process events
  14.532 -         * @return          a {@code PropertyChangeListenerProxy} object
  14.533 -         */
  14.534 -        @Override
  14.535 -        protected PropertyChangeListener newProxy(String name, PropertyChangeListener listener) {
  14.536 -            return new PropertyChangeListenerProxy(name, listener);
  14.537 -        }
  14.538 -    }
  14.539 -}
    15.1 --- a/emul/compact/src/main/java/java/beans/PropertyVetoException.java	Mon Feb 25 19:00:08 2013 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,64 +0,0 @@
    15.4 -/*
    15.5 - * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
    15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 - *
    15.8 - * This code is free software; you can redistribute it and/or modify it
    15.9 - * under the terms of the GNU General Public License version 2 only, as
   15.10 - * published by the Free Software Foundation.  Oracle designates this
   15.11 - * particular file as subject to the "Classpath" exception as provided
   15.12 - * by Oracle in the LICENSE file that accompanied this code.
   15.13 - *
   15.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   15.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.17 - * version 2 for more details (a copy is included in the LICENSE file that
   15.18 - * accompanied this code).
   15.19 - *
   15.20 - * You should have received a copy of the GNU General Public License version
   15.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   15.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.23 - *
   15.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.25 - * or visit www.oracle.com if you need additional information or have any
   15.26 - * questions.
   15.27 - */
   15.28 -
   15.29 -package java.beans;
   15.30 -
   15.31 -
   15.32 -/**
   15.33 - * A PropertyVetoException is thrown when a proposed change to a
   15.34 - * property represents an unacceptable value.
   15.35 - */
   15.36 -
   15.37 -public
   15.38 -class PropertyVetoException extends Exception {
   15.39 -    private static final long serialVersionUID = 129596057694162164L;
   15.40 -
   15.41 -    /**
   15.42 -     * Constructs a <code>PropertyVetoException</code> with a
   15.43 -     * detailed message.
   15.44 -     *
   15.45 -     * @param mess Descriptive message
   15.46 -     * @param evt A PropertyChangeEvent describing the vetoed change.
   15.47 -     */
   15.48 -    public PropertyVetoException(String mess, PropertyChangeEvent evt) {
   15.49 -        super(mess);
   15.50 -        this.evt = evt;
   15.51 -    }
   15.52 -
   15.53 -     /**
   15.54 -     * Gets the vetoed <code>PropertyChangeEvent</code>.
   15.55 -     *
   15.56 -     * @return A PropertyChangeEvent describing the vetoed change.
   15.57 -     */
   15.58 -    public PropertyChangeEvent getPropertyChangeEvent() {
   15.59 -        return evt;
   15.60 -    }
   15.61 -
   15.62 -    /**
   15.63 -     * A PropertyChangeEvent describing the vetoed change.
   15.64 -     * @serial
   15.65 -     */
   15.66 -    private PropertyChangeEvent evt;
   15.67 -}
    16.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeListener.java	Mon Feb 25 19:00:08 2013 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,44 +0,0 @@
    16.4 -/*
    16.5 - * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
    16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 - *
    16.8 - * This code is free software; you can redistribute it and/or modify it
    16.9 - * under the terms of the GNU General Public License version 2 only, as
   16.10 - * published by the Free Software Foundation.  Oracle designates this
   16.11 - * particular file as subject to the "Classpath" exception as provided
   16.12 - * by Oracle in the LICENSE file that accompanied this code.
   16.13 - *
   16.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   16.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.17 - * version 2 for more details (a copy is included in the LICENSE file that
   16.18 - * accompanied this code).
   16.19 - *
   16.20 - * You should have received a copy of the GNU General Public License version
   16.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   16.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.23 - *
   16.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.25 - * or visit www.oracle.com if you need additional information or have any
   16.26 - * questions.
   16.27 - */
   16.28 -
   16.29 -package java.beans;
   16.30 -
   16.31 -/**
   16.32 - * A VetoableChange event gets fired whenever a bean changes a "constrained"
   16.33 - * property.  You can register a VetoableChangeListener with a source bean
   16.34 - * so as to be notified of any constrained property updates.
   16.35 - */
   16.36 -public interface VetoableChangeListener extends java.util.EventListener {
   16.37 -    /**
   16.38 -     * This method gets called when a constrained property is changed.
   16.39 -     *
   16.40 -     * @param     evt a <code>PropertyChangeEvent</code> object describing the
   16.41 -     *                event source and the property that has changed.
   16.42 -     * @exception PropertyVetoException if the recipient wishes the property
   16.43 -     *              change to be rolled back.
   16.44 -     */
   16.45 -    void vetoableChange(PropertyChangeEvent evt)
   16.46 -                                throws PropertyVetoException;
   16.47 -}
    17.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeListenerProxy.java	Mon Feb 25 19:00:08 2013 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,84 +0,0 @@
    17.4 -/*
    17.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
    17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 - *
    17.8 - * This code is free software; you can redistribute it and/or modify it
    17.9 - * under the terms of the GNU General Public License version 2 only, as
   17.10 - * published by the Free Software Foundation.  Oracle designates this
   17.11 - * particular file as subject to the "Classpath" exception as provided
   17.12 - * by Oracle in the LICENSE file that accompanied this code.
   17.13 - *
   17.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   17.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.17 - * version 2 for more details (a copy is included in the LICENSE file that
   17.18 - * accompanied this code).
   17.19 - *
   17.20 - * You should have received a copy of the GNU General Public License version
   17.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   17.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.23 - *
   17.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.25 - * or visit www.oracle.com if you need additional information or have any
   17.26 - * questions.
   17.27 - */
   17.28 -
   17.29 -package java.beans;
   17.30 -
   17.31 -import java.util.EventListenerProxy;
   17.32 -
   17.33 -/**
   17.34 - * A class which extends the {@code EventListenerProxy}
   17.35 - * specifically for adding a {@code VetoableChangeListener}
   17.36 - * with a "constrained" property.
   17.37 - * Instances of this class can be added
   17.38 - * as {@code VetoableChangeListener}s to a bean
   17.39 - * which supports firing vetoable change events.
   17.40 - * <p>
   17.41 - * If the object has a {@code getVetoableChangeListeners} method
   17.42 - * then the array returned could be a mixture of {@code VetoableChangeListener}
   17.43 - * and {@code VetoableChangeListenerProxy} objects.
   17.44 - *
   17.45 - * @see java.util.EventListenerProxy
   17.46 - * @see VetoableChangeSupport#getVetoableChangeListeners
   17.47 - * @since 1.4
   17.48 - */
   17.49 -public class VetoableChangeListenerProxy
   17.50 -        extends EventListenerProxy<VetoableChangeListener>
   17.51 -        implements VetoableChangeListener {
   17.52 -
   17.53 -    private final String propertyName;
   17.54 -
   17.55 -    /**
   17.56 -     * Constructor which binds the {@code VetoableChangeListener}
   17.57 -     * to a specific property.
   17.58 -     *
   17.59 -     * @param propertyName  the name of the property to listen on
   17.60 -     * @param listener      the listener object
   17.61 -     */
   17.62 -    public VetoableChangeListenerProxy(String propertyName, VetoableChangeListener listener) {
   17.63 -        super(listener);
   17.64 -        this.propertyName = propertyName;
   17.65 -    }
   17.66 -
   17.67 -    /**
   17.68 -    * Forwards the property change event to the listener delegate.
   17.69 -    *
   17.70 -    * @param event  the property change event
   17.71 -    *
   17.72 -    * @exception PropertyVetoException if the recipient wishes the property
   17.73 -    *                                  change to be rolled back
   17.74 -    */
   17.75 -    public void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException{
   17.76 -        getListener().vetoableChange(event);
   17.77 -    }
   17.78 -
   17.79 -    /**
   17.80 -     * Returns the name of the named property associated with the listener.
   17.81 -     *
   17.82 -     * @return the name of the named property associated with the listener
   17.83 -     */
   17.84 -    public String getPropertyName() {
   17.85 -        return this.propertyName;
   17.86 -    }
   17.87 -}
    18.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeSupport.java	Mon Feb 25 19:00:08 2013 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,526 +0,0 @@
    18.4 -/*
    18.5 - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
    18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 - *
    18.8 - * This code is free software; you can redistribute it and/or modify it
    18.9 - * under the terms of the GNU General Public License version 2 only, as
   18.10 - * published by the Free Software Foundation.  Oracle designates this
   18.11 - * particular file as subject to the "Classpath" exception as provided
   18.12 - * by Oracle in the LICENSE file that accompanied this code.
   18.13 - *
   18.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   18.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.17 - * version 2 for more details (a copy is included in the LICENSE file that
   18.18 - * accompanied this code).
   18.19 - *
   18.20 - * You should have received a copy of the GNU General Public License version
   18.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   18.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.23 - *
   18.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.25 - * or visit www.oracle.com if you need additional information or have any
   18.26 - * questions.
   18.27 - */
   18.28 -package java.beans;
   18.29 -
   18.30 -import java.io.Serializable;
   18.31 -import java.io.ObjectStreamField;
   18.32 -import java.io.ObjectOutputStream;
   18.33 -import java.io.ObjectInputStream;
   18.34 -import java.io.IOException;
   18.35 -import java.util.Hashtable;
   18.36 -import java.util.Map.Entry;
   18.37 -import org.apidesign.bck2brwsr.emul.lang.System;
   18.38 -
   18.39 -/**
   18.40 - * This is a utility class that can be used by beans that support constrained
   18.41 - * properties.  It manages a list of listeners and dispatches
   18.42 - * {@link PropertyChangeEvent}s to them.  You can use an instance of this class
   18.43 - * as a member field of your bean and delegate these types of work to it.
   18.44 - * The {@link VetoableChangeListener} can be registered for all properties
   18.45 - * or for a property specified by name.
   18.46 - * <p>
   18.47 - * Here is an example of {@code VetoableChangeSupport} usage that follows
   18.48 - * the rules and recommendations laid out in the JavaBeans&trade; specification:
   18.49 - * <pre>
   18.50 - * public class MyBean {
   18.51 - *     private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
   18.52 - *
   18.53 - *     public void addVetoableChangeListener(VetoableChangeListener listener) {
   18.54 - *         this.vcs.addVetoableChangeListener(listener);
   18.55 - *     }
   18.56 - *
   18.57 - *     public void removeVetoableChangeListener(VetoableChangeListener listener) {
   18.58 - *         this.vcs.removeVetoableChangeListener(listener);
   18.59 - *     }
   18.60 - *
   18.61 - *     private String value;
   18.62 - *
   18.63 - *     public String getValue() {
   18.64 - *         return this.value;
   18.65 - *     }
   18.66 - *
   18.67 - *     public void setValue(String newValue) throws PropertyVetoException {
   18.68 - *         String oldValue = this.value;
   18.69 - *         this.vcs.fireVetoableChange("value", oldValue, newValue);
   18.70 - *         this.value = newValue;
   18.71 - *     }
   18.72 - *
   18.73 - *     [...]
   18.74 - * }
   18.75 - * </pre>
   18.76 - * <p>
   18.77 - * A {@code VetoableChangeSupport} instance is thread-safe.
   18.78 - * <p>
   18.79 - * This class is serializable.  When it is serialized it will save
   18.80 - * (and restore) any listeners that are themselves serializable.  Any
   18.81 - * non-serializable listeners will be skipped during serialization.
   18.82 - *
   18.83 - * @see PropertyChangeSupport
   18.84 - */
   18.85 -public class VetoableChangeSupport implements Serializable {
   18.86 -    private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
   18.87 -
   18.88 -    /**
   18.89 -     * Constructs a <code>VetoableChangeSupport</code> object.
   18.90 -     *
   18.91 -     * @param sourceBean  The bean to be given as the source for any events.
   18.92 -     */
   18.93 -    public VetoableChangeSupport(Object sourceBean) {
   18.94 -        if (sourceBean == null) {
   18.95 -            throw new NullPointerException();
   18.96 -        }
   18.97 -        source = sourceBean;
   18.98 -    }
   18.99 -
  18.100 -    /**
  18.101 -     * Add a VetoableChangeListener to the listener list.
  18.102 -     * The listener is registered for all properties.
  18.103 -     * The same listener object may be added more than once, and will be called
  18.104 -     * as many times as it is added.
  18.105 -     * If <code>listener</code> is null, no exception is thrown and no action
  18.106 -     * is taken.
  18.107 -     *
  18.108 -     * @param listener  The VetoableChangeListener to be added
  18.109 -     */
  18.110 -    public void addVetoableChangeListener(VetoableChangeListener listener) {
  18.111 -        if (listener == null) {
  18.112 -            return;
  18.113 -        }
  18.114 -        if (listener instanceof VetoableChangeListenerProxy) {
  18.115 -            VetoableChangeListenerProxy proxy =
  18.116 -                    (VetoableChangeListenerProxy)listener;
  18.117 -            // Call two argument add method.
  18.118 -            addVetoableChangeListener(proxy.getPropertyName(),
  18.119 -                                      proxy.getListener());
  18.120 -        } else {
  18.121 -            this.map.add(null, listener);
  18.122 -        }
  18.123 -    }
  18.124 -
  18.125 -    /**
  18.126 -     * Remove a VetoableChangeListener from the listener list.
  18.127 -     * This removes a VetoableChangeListener that was registered
  18.128 -     * for all properties.
  18.129 -     * If <code>listener</code> was added more than once to the same event
  18.130 -     * source, it will be notified one less time after being removed.
  18.131 -     * If <code>listener</code> is null, or was never added, no exception is
  18.132 -     * thrown and no action is taken.
  18.133 -     *
  18.134 -     * @param listener  The VetoableChangeListener to be removed
  18.135 -     */
  18.136 -    public void removeVetoableChangeListener(VetoableChangeListener listener) {
  18.137 -        if (listener == null) {
  18.138 -            return;
  18.139 -        }
  18.140 -        if (listener instanceof VetoableChangeListenerProxy) {
  18.141 -            VetoableChangeListenerProxy proxy =
  18.142 -                    (VetoableChangeListenerProxy)listener;
  18.143 -            // Call two argument remove method.
  18.144 -            removeVetoableChangeListener(proxy.getPropertyName(),
  18.145 -                                         proxy.getListener());
  18.146 -        } else {
  18.147 -            this.map.remove(null, listener);
  18.148 -        }
  18.149 -    }
  18.150 -
  18.151 -    /**
  18.152 -     * Returns an array of all the listeners that were added to the
  18.153 -     * VetoableChangeSupport object with addVetoableChangeListener().
  18.154 -     * <p>
  18.155 -     * If some listeners have been added with a named property, then
  18.156 -     * the returned array will be a mixture of VetoableChangeListeners
  18.157 -     * and <code>VetoableChangeListenerProxy</code>s. If the calling
  18.158 -     * method is interested in distinguishing the listeners then it must
  18.159 -     * test each element to see if it's a
  18.160 -     * <code>VetoableChangeListenerProxy</code>, perform the cast, and examine
  18.161 -     * the parameter.
  18.162 -     *
  18.163 -     * <pre>
  18.164 -     * VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
  18.165 -     * for (int i = 0; i < listeners.length; i++) {
  18.166 -     *        if (listeners[i] instanceof VetoableChangeListenerProxy) {
  18.167 -     *     VetoableChangeListenerProxy proxy =
  18.168 -     *                    (VetoableChangeListenerProxy)listeners[i];
  18.169 -     *     if (proxy.getPropertyName().equals("foo")) {
  18.170 -     *       // proxy is a VetoableChangeListener which was associated
  18.171 -     *       // with the property named "foo"
  18.172 -     *     }
  18.173 -     *   }
  18.174 -     * }
  18.175 -     *</pre>
  18.176 -     *
  18.177 -     * @see VetoableChangeListenerProxy
  18.178 -     * @return all of the <code>VetoableChangeListeners</code> added or an
  18.179 -     *         empty array if no listeners have been added
  18.180 -     * @since 1.4
  18.181 -     */
  18.182 -    public VetoableChangeListener[] getVetoableChangeListeners(){
  18.183 -        return this.map.getListeners();
  18.184 -    }
  18.185 -
  18.186 -    /**
  18.187 -     * Add a VetoableChangeListener for a specific property.  The listener
  18.188 -     * will be invoked only when a call on fireVetoableChange names that
  18.189 -     * specific property.
  18.190 -     * The same listener object may be added more than once.  For each
  18.191 -     * property,  the listener will be invoked the number of times it was added
  18.192 -     * for that property.
  18.193 -     * If <code>propertyName</code> or <code>listener</code> is null, no
  18.194 -     * exception is thrown and no action is taken.
  18.195 -     *
  18.196 -     * @param propertyName  The name of the property to listen on.
  18.197 -     * @param listener  The VetoableChangeListener to be added
  18.198 -     */
  18.199 -    public void addVetoableChangeListener(
  18.200 -                                String propertyName,
  18.201 -                VetoableChangeListener listener) {
  18.202 -        if (listener == null || propertyName == null) {
  18.203 -            return;
  18.204 -        }
  18.205 -        listener = this.map.extract(listener);
  18.206 -        if (listener != null) {
  18.207 -            this.map.add(propertyName, listener);
  18.208 -        }
  18.209 -    }
  18.210 -
  18.211 -    /**
  18.212 -     * Remove a VetoableChangeListener for a specific property.
  18.213 -     * If <code>listener</code> was added more than once to the same event
  18.214 -     * source for the specified property, it will be notified one less time
  18.215 -     * after being removed.
  18.216 -     * If <code>propertyName</code> is null, no exception is thrown and no
  18.217 -     * action is taken.
  18.218 -     * If <code>listener</code> is null, or was never added for the specified
  18.219 -     * property, no exception is thrown and no action is taken.
  18.220 -     *
  18.221 -     * @param propertyName  The name of the property that was listened on.
  18.222 -     * @param listener  The VetoableChangeListener to be removed
  18.223 -     */
  18.224 -    public void removeVetoableChangeListener(
  18.225 -                                String propertyName,
  18.226 -                VetoableChangeListener listener) {
  18.227 -        if (listener == null || propertyName == null) {
  18.228 -            return;
  18.229 -        }
  18.230 -        listener = this.map.extract(listener);
  18.231 -        if (listener != null) {
  18.232 -            this.map.remove(propertyName, listener);
  18.233 -        }
  18.234 -    }
  18.235 -
  18.236 -    /**
  18.237 -     * Returns an array of all the listeners which have been associated
  18.238 -     * with the named property.
  18.239 -     *
  18.240 -     * @param propertyName  The name of the property being listened to
  18.241 -     * @return all the <code>VetoableChangeListeners</code> associated with
  18.242 -     *         the named property.  If no such listeners have been added,
  18.243 -     *         or if <code>propertyName</code> is null, an empty array is
  18.244 -     *         returned.
  18.245 -     * @since 1.4
  18.246 -     */
  18.247 -    public VetoableChangeListener[] getVetoableChangeListeners(String propertyName) {
  18.248 -        return this.map.getListeners(propertyName);
  18.249 -    }
  18.250 -
  18.251 -    /**
  18.252 -     * Reports a constrained property update to listeners
  18.253 -     * that have been registered to track updates of
  18.254 -     * all properties or a property with the specified name.
  18.255 -     * <p>
  18.256 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  18.257 -     * If one of the listeners vetoes the update, this method passes
  18.258 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  18.259 -     * to all listeners that already confirmed this update
  18.260 -     * and throws the {@code PropertyVetoException} again.
  18.261 -     * <p>
  18.262 -     * No event is fired if old and new values are equal and non-null.
  18.263 -     * <p>
  18.264 -     * This is merely a convenience wrapper around the more general
  18.265 -     * {@link #fireVetoableChange(PropertyChangeEvent)} method.
  18.266 -     *
  18.267 -     * @param propertyName  the programmatic name of the property that is about to change
  18.268 -     * @param oldValue      the old value of the property
  18.269 -     * @param newValue      the new value of the property
  18.270 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  18.271 -     */
  18.272 -    public void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
  18.273 -            throws PropertyVetoException {
  18.274 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  18.275 -            fireVetoableChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
  18.276 -        }
  18.277 -    }
  18.278 -
  18.279 -    /**
  18.280 -     * Reports an integer constrained property update to listeners
  18.281 -     * that have been registered to track updates of
  18.282 -     * all properties or a property with the specified name.
  18.283 -     * <p>
  18.284 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  18.285 -     * If one of the listeners vetoes the update, this method passes
  18.286 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  18.287 -     * to all listeners that already confirmed this update
  18.288 -     * and throws the {@code PropertyVetoException} again.
  18.289 -     * <p>
  18.290 -     * No event is fired if old and new values are equal.
  18.291 -     * <p>
  18.292 -     * This is merely a convenience wrapper around the more general
  18.293 -     * {@link #fireVetoableChange(String, Object, Object)} method.
  18.294 -     *
  18.295 -     * @param propertyName  the programmatic name of the property that is about to change
  18.296 -     * @param oldValue      the old value of the property
  18.297 -     * @param newValue      the new value of the property
  18.298 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  18.299 -     */
  18.300 -    public void fireVetoableChange(String propertyName, int oldValue, int newValue)
  18.301 -            throws PropertyVetoException {
  18.302 -        if (oldValue != newValue) {
  18.303 -            fireVetoableChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  18.304 -        }
  18.305 -    }
  18.306 -
  18.307 -    /**
  18.308 -     * Reports a boolean constrained property update to listeners
  18.309 -     * that have been registered to track updates of
  18.310 -     * all properties or a property with the specified name.
  18.311 -     * <p>
  18.312 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  18.313 -     * If one of the listeners vetoes the update, this method passes
  18.314 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  18.315 -     * to all listeners that already confirmed this update
  18.316 -     * and throws the {@code PropertyVetoException} again.
  18.317 -     * <p>
  18.318 -     * No event is fired if old and new values are equal.
  18.319 -     * <p>
  18.320 -     * This is merely a convenience wrapper around the more general
  18.321 -     * {@link #fireVetoableChange(String, Object, Object)} method.
  18.322 -     *
  18.323 -     * @param propertyName  the programmatic name of the property that is about to change
  18.324 -     * @param oldValue      the old value of the property
  18.325 -     * @param newValue      the new value of the property
  18.326 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  18.327 -     */
  18.328 -    public void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue)
  18.329 -            throws PropertyVetoException {
  18.330 -        if (oldValue != newValue) {
  18.331 -            fireVetoableChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  18.332 -        }
  18.333 -    }
  18.334 -
  18.335 -    /**
  18.336 -     * Fires a property change event to listeners
  18.337 -     * that have been registered to track updates of
  18.338 -     * all properties or a property with the specified name.
  18.339 -     * <p>
  18.340 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  18.341 -     * If one of the listeners vetoes the update, this method passes
  18.342 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  18.343 -     * to all listeners that already confirmed this update
  18.344 -     * and throws the {@code PropertyVetoException} again.
  18.345 -     * <p>
  18.346 -     * No event is fired if the given event's old and new values are equal and non-null.
  18.347 -     *
  18.348 -     * @param event  the {@code PropertyChangeEvent} to be fired
  18.349 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  18.350 -     */
  18.351 -    public void fireVetoableChange(PropertyChangeEvent event)
  18.352 -            throws PropertyVetoException {
  18.353 -        Object oldValue = event.getOldValue();
  18.354 -        Object newValue = event.getNewValue();
  18.355 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  18.356 -            String name = event.getPropertyName();
  18.357 -
  18.358 -            VetoableChangeListener[] common = this.map.get(null);
  18.359 -            VetoableChangeListener[] named = (name != null)
  18.360 -                        ? this.map.get(name)
  18.361 -                        : null;
  18.362 -
  18.363 -            VetoableChangeListener[] listeners;
  18.364 -            if (common == null) {
  18.365 -                listeners = named;
  18.366 -            }
  18.367 -            else if (named == null) {
  18.368 -                listeners = common;
  18.369 -            }
  18.370 -            else {
  18.371 -                listeners = new VetoableChangeListener[common.length + named.length];
  18.372 -                System.arraycopy(common, 0, listeners, 0, common.length);
  18.373 -                System.arraycopy(named, 0, listeners, common.length, named.length);
  18.374 -            }
  18.375 -            if (listeners != null) {
  18.376 -                int current = 0;
  18.377 -                try {
  18.378 -                    while (current < listeners.length) {
  18.379 -                        listeners[current].vetoableChange(event);
  18.380 -                        current++;
  18.381 -                    }
  18.382 -                }
  18.383 -                catch (PropertyVetoException veto) {
  18.384 -                    event = new PropertyChangeEvent(this.source, name, newValue, oldValue);
  18.385 -                    for (int i = 0; i < current; i++) {
  18.386 -                        try {
  18.387 -                            listeners[i].vetoableChange(event);
  18.388 -                        }
  18.389 -                        catch (PropertyVetoException exception) {
  18.390 -                            // ignore exceptions that occur during rolling back
  18.391 -                        }
  18.392 -                    }
  18.393 -                    throw veto; // rethrow the veto exception
  18.394 -                }
  18.395 -            }
  18.396 -        }
  18.397 -    }
  18.398 -
  18.399 -    /**
  18.400 -     * Check if there are any listeners for a specific property, including
  18.401 -     * those registered on all properties.  If <code>propertyName</code>
  18.402 -     * is null, only check for listeners registered on all properties.
  18.403 -     *
  18.404 -     * @param propertyName  the property name.
  18.405 -     * @return true if there are one or more listeners for the given property
  18.406 -     */
  18.407 -    public boolean hasListeners(String propertyName) {
  18.408 -        return this.map.hasListeners(propertyName);
  18.409 -    }
  18.410 -
  18.411 -    /**
  18.412 -     * @serialData Null terminated list of <code>VetoableChangeListeners</code>.
  18.413 -     * <p>
  18.414 -     * At serialization time we skip non-serializable listeners and
  18.415 -     * only serialize the serializable listeners.
  18.416 -     */
  18.417 -    private void writeObject(ObjectOutputStream s) throws IOException {
  18.418 -        Hashtable<String, VetoableChangeSupport> children = null;
  18.419 -        VetoableChangeListener[] listeners = null;
  18.420 -        synchronized (this.map) {
  18.421 -            for (Entry<String, VetoableChangeListener[]> entry : this.map.getEntries()) {
  18.422 -                String property = entry.getKey();
  18.423 -                if (property == null) {
  18.424 -                    listeners = entry.getValue();
  18.425 -                } else {
  18.426 -                    if (children == null) {
  18.427 -                        children = new Hashtable<String, VetoableChangeSupport>();
  18.428 -                    }
  18.429 -                    VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
  18.430 -                    vcs.map.set(null, entry.getValue());
  18.431 -                    children.put(property, vcs);
  18.432 -                }
  18.433 -            }
  18.434 -        }
  18.435 -        ObjectOutputStream.PutField fields = s.putFields();
  18.436 -        fields.put("children", children);
  18.437 -        fields.put("source", this.source);
  18.438 -        fields.put("vetoableChangeSupportSerializedDataVersion", 2);
  18.439 -        s.writeFields();
  18.440 -
  18.441 -        if (listeners != null) {
  18.442 -            for (VetoableChangeListener l : listeners) {
  18.443 -                if (l instanceof Serializable) {
  18.444 -                    s.writeObject(l);
  18.445 -                }
  18.446 -            }
  18.447 -        }
  18.448 -        s.writeObject(null);
  18.449 -    }
  18.450 -
  18.451 -    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
  18.452 -        this.map = new VetoableChangeListenerMap();
  18.453 -
  18.454 -        ObjectInputStream.GetField fields = s.readFields();
  18.455 -
  18.456 -        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>) fields.get("children", null);
  18.457 -        this.source = fields.get("source", null);
  18.458 -        fields.get("vetoableChangeSupportSerializedDataVersion", 2);
  18.459 -
  18.460 -        Object listenerOrNull;
  18.461 -        while (null != (listenerOrNull = s.readObject())) {
  18.462 -            this.map.add(null, (VetoableChangeListener)listenerOrNull);
  18.463 -        }
  18.464 -        if (children != null) {
  18.465 -            for (Entry<String, VetoableChangeSupport> entry : children.entrySet()) {
  18.466 -                for (VetoableChangeListener listener : entry.getValue().getVetoableChangeListeners()) {
  18.467 -                    this.map.add(entry.getKey(), listener);
  18.468 -                }
  18.469 -            }
  18.470 -        }
  18.471 -    }
  18.472 -
  18.473 -    /**
  18.474 -     * The object to be provided as the "source" for any generated events.
  18.475 -     */
  18.476 -    private Object source;
  18.477 -
  18.478 -    /**
  18.479 -     * @serialField children                                   Hashtable
  18.480 -     * @serialField source                                     Object
  18.481 -     * @serialField vetoableChangeSupportSerializedDataVersion int
  18.482 -     */
  18.483 -    private static final ObjectStreamField[] serialPersistentFields = {
  18.484 -            new ObjectStreamField("children", Hashtable.class),
  18.485 -            new ObjectStreamField("source", Object.class),
  18.486 -            new ObjectStreamField("vetoableChangeSupportSerializedDataVersion", Integer.TYPE)
  18.487 -    };
  18.488 -
  18.489 -    /**
  18.490 -     * Serialization version ID, so we're compatible with JDK 1.1
  18.491 -     */
  18.492 -    static final long serialVersionUID = -5090210921595982017L;
  18.493 -
  18.494 -    /**
  18.495 -     * This is a {@link ChangeListenerMap ChangeListenerMap} implementation
  18.496 -     * that works with {@link VetoableChangeListener VetoableChangeListener} objects.
  18.497 -     */
  18.498 -    private static final class VetoableChangeListenerMap extends ChangeListenerMap<VetoableChangeListener> {
  18.499 -        private static final VetoableChangeListener[] EMPTY = {};
  18.500 -
  18.501 -        /**
  18.502 -         * Creates an array of {@link VetoableChangeListener VetoableChangeListener} objects.
  18.503 -         * This method uses the same instance of the empty array
  18.504 -         * when {@code length} equals {@code 0}.
  18.505 -         *
  18.506 -         * @param length  the array length
  18.507 -         * @return        an array with specified length
  18.508 -         */
  18.509 -        @Override
  18.510 -        protected VetoableChangeListener[] newArray(int length) {
  18.511 -            return (0 < length)
  18.512 -                    ? new VetoableChangeListener[length]
  18.513 -                    : EMPTY;
  18.514 -        }
  18.515 -
  18.516 -        /**
  18.517 -         * Creates a {@link VetoableChangeListenerProxy VetoableChangeListenerProxy}
  18.518 -         * object for the specified property.
  18.519 -         *
  18.520 -         * @param name      the name of the property to listen on
  18.521 -         * @param listener  the listener to process events
  18.522 -         * @return          a {@code VetoableChangeListenerProxy} object
  18.523 -         */
  18.524 -        @Override
  18.525 -        protected VetoableChangeListener newProxy(String name, VetoableChangeListener listener) {
  18.526 -            return new VetoableChangeListenerProxy(name, listener);
  18.527 -        }
  18.528 -    }
  18.529 -}
    19.1 --- a/emul/compact/src/main/java/java/io/Bits.java	Mon Feb 25 19:00:08 2013 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,123 +0,0 @@
    19.4 -/*
    19.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 - *
    19.8 - * This code is free software; you can redistribute it and/or modify it
    19.9 - * under the terms of the GNU General Public License version 2 only, as
   19.10 - * published by the Free Software Foundation.  Oracle designates this
   19.11 - * particular file as subject to the "Classpath" exception as provided
   19.12 - * by Oracle in the LICENSE file that accompanied this code.
   19.13 - *
   19.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 - * version 2 for more details (a copy is included in the LICENSE file that
   19.18 - * accompanied this code).
   19.19 - *
   19.20 - * You should have received a copy of the GNU General Public License version
   19.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 - *
   19.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 - * or visit www.oracle.com if you need additional information or have any
   19.26 - * questions.
   19.27 - */
   19.28 -
   19.29 -package java.io;
   19.30 -
   19.31 -/**
   19.32 - * Utility methods for packing/unpacking primitive values in/out of byte arrays
   19.33 - * using big-endian byte ordering.
   19.34 - */
   19.35 -class Bits {
   19.36 -
   19.37 -    /*
   19.38 -     * Methods for unpacking primitive values from byte arrays starting at
   19.39 -     * given offsets.
   19.40 -     */
   19.41 -
   19.42 -    static boolean getBoolean(byte[] b, int off) {
   19.43 -        return b[off] != 0;
   19.44 -    }
   19.45 -
   19.46 -    static char getChar(byte[] b, int off) {
   19.47 -        return (char) ((b[off + 1] & 0xFF) +
   19.48 -                       (b[off] << 8));
   19.49 -    }
   19.50 -
   19.51 -    static short getShort(byte[] b, int off) {
   19.52 -        return (short) ((b[off + 1] & 0xFF) +
   19.53 -                        (b[off] << 8));
   19.54 -    }
   19.55 -
   19.56 -    static int getInt(byte[] b, int off) {
   19.57 -        return ((b[off + 3] & 0xFF)      ) +
   19.58 -               ((b[off + 2] & 0xFF) <<  8) +
   19.59 -               ((b[off + 1] & 0xFF) << 16) +
   19.60 -               ((b[off    ]       ) << 24);
   19.61 -    }
   19.62 -
   19.63 -    static float getFloat(byte[] b, int off) {
   19.64 -        return Float.intBitsToFloat(getInt(b, off));
   19.65 -    }
   19.66 -
   19.67 -    static long getLong(byte[] b, int off) {
   19.68 -        return ((b[off + 7] & 0xFFL)      ) +
   19.69 -               ((b[off + 6] & 0xFFL) <<  8) +
   19.70 -               ((b[off + 5] & 0xFFL) << 16) +
   19.71 -               ((b[off + 4] & 0xFFL) << 24) +
   19.72 -               ((b[off + 3] & 0xFFL) << 32) +
   19.73 -               ((b[off + 2] & 0xFFL) << 40) +
   19.74 -               ((b[off + 1] & 0xFFL) << 48) +
   19.75 -               (((long) b[off])      << 56);
   19.76 -    }
   19.77 -
   19.78 -    static double getDouble(byte[] b, int off) {
   19.79 -        return Double.longBitsToDouble(getLong(b, off));
   19.80 -    }
   19.81 -
   19.82 -    /*
   19.83 -     * Methods for packing primitive values into byte arrays starting at given
   19.84 -     * offsets.
   19.85 -     */
   19.86 -
   19.87 -    static void putBoolean(byte[] b, int off, boolean val) {
   19.88 -        b[off] = (byte) (val ? 1 : 0);
   19.89 -    }
   19.90 -
   19.91 -    static void putChar(byte[] b, int off, char val) {
   19.92 -        b[off + 1] = (byte) (val      );
   19.93 -        b[off    ] = (byte) (val >>> 8);
   19.94 -    }
   19.95 -
   19.96 -    static void putShort(byte[] b, int off, short val) {
   19.97 -        b[off + 1] = (byte) (val      );
   19.98 -        b[off    ] = (byte) (val >>> 8);
   19.99 -    }
  19.100 -
  19.101 -    static void putInt(byte[] b, int off, int val) {
  19.102 -        b[off + 3] = (byte) (val       );
  19.103 -        b[off + 2] = (byte) (val >>>  8);
  19.104 -        b[off + 1] = (byte) (val >>> 16);
  19.105 -        b[off    ] = (byte) (val >>> 24);
  19.106 -    }
  19.107 -
  19.108 -    static void putFloat(byte[] b, int off, float val) {
  19.109 -        putInt(b, off,  Float.floatToIntBits(val));
  19.110 -    }
  19.111 -
  19.112 -    static void putLong(byte[] b, int off, long val) {
  19.113 -        b[off + 7] = (byte) (val       );
  19.114 -        b[off + 6] = (byte) (val >>>  8);
  19.115 -        b[off + 5] = (byte) (val >>> 16);
  19.116 -        b[off + 4] = (byte) (val >>> 24);
  19.117 -        b[off + 3] = (byte) (val >>> 32);
  19.118 -        b[off + 2] = (byte) (val >>> 40);
  19.119 -        b[off + 1] = (byte) (val >>> 48);
  19.120 -        b[off    ] = (byte) (val >>> 56);
  19.121 -    }
  19.122 -
  19.123 -    static void putDouble(byte[] b, int off, double val) {
  19.124 -        putLong(b, off, Double.doubleToLongBits(val));
  19.125 -    }
  19.126 -}
    20.1 --- a/emul/compact/src/main/java/java/io/BufferedOutputStream.java	Mon Feb 25 19:00:08 2013 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,143 +0,0 @@
    20.4 -/*
    20.5 - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
    20.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 - *
    20.8 - * This code is free software; you can redistribute it and/or modify it
    20.9 - * under the terms of the GNU General Public License version 2 only, as
   20.10 - * published by the Free Software Foundation.  Oracle designates this
   20.11 - * particular file as subject to the "Classpath" exception as provided
   20.12 - * by Oracle in the LICENSE file that accompanied this code.
   20.13 - *
   20.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   20.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.17 - * version 2 for more details (a copy is included in the LICENSE file that
   20.18 - * accompanied this code).
   20.19 - *
   20.20 - * You should have received a copy of the GNU General Public License version
   20.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   20.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.23 - *
   20.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.25 - * or visit www.oracle.com if you need additional information or have any
   20.26 - * questions.
   20.27 - */
   20.28 -
   20.29 -package java.io;
   20.30 -
   20.31 -/**
   20.32 - * The class implements a buffered output stream. By setting up such
   20.33 - * an output stream, an application can write bytes to the underlying
   20.34 - * output stream without necessarily causing a call to the underlying
   20.35 - * system for each byte written.
   20.36 - *
   20.37 - * @author  Arthur van Hoff
   20.38 - * @since   JDK1.0
   20.39 - */
   20.40 -public
   20.41 -class BufferedOutputStream extends FilterOutputStream {
   20.42 -    /**
   20.43 -     * The internal buffer where data is stored.
   20.44 -     */
   20.45 -    protected byte buf[];
   20.46 -
   20.47 -    /**
   20.48 -     * The number of valid bytes in the buffer. This value is always
   20.49 -     * in the range <tt>0</tt> through <tt>buf.length</tt>; elements
   20.50 -     * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
   20.51 -     * byte data.
   20.52 -     */
   20.53 -    protected int count;
   20.54 -
   20.55 -    /**
   20.56 -     * Creates a new buffered output stream to write data to the
   20.57 -     * specified underlying output stream.
   20.58 -     *
   20.59 -     * @param   out   the underlying output stream.
   20.60 -     */
   20.61 -    public BufferedOutputStream(OutputStream out) {
   20.62 -        this(out, 8192);
   20.63 -    }
   20.64 -
   20.65 -    /**
   20.66 -     * Creates a new buffered output stream to write data to the
   20.67 -     * specified underlying output stream with the specified buffer
   20.68 -     * size.
   20.69 -     *
   20.70 -     * @param   out    the underlying output stream.
   20.71 -     * @param   size   the buffer size.
   20.72 -     * @exception IllegalArgumentException if size &lt;= 0.
   20.73 -     */
   20.74 -    public BufferedOutputStream(OutputStream out, int size) {
   20.75 -        super(out);
   20.76 -        if (size <= 0) {
   20.77 -            throw new IllegalArgumentException("Buffer size <= 0");
   20.78 -        }
   20.79 -        buf = new byte[size];
   20.80 -    }
   20.81 -
   20.82 -    /** Flush the internal buffer */
   20.83 -    private void flushBuffer() throws IOException {
   20.84 -        if (count > 0) {
   20.85 -            out.write(buf, 0, count);
   20.86 -            count = 0;
   20.87 -        }
   20.88 -    }
   20.89 -
   20.90 -    /**
   20.91 -     * Writes the specified byte to this buffered output stream.
   20.92 -     *
   20.93 -     * @param      b   the byte to be written.
   20.94 -     * @exception  IOException  if an I/O error occurs.
   20.95 -     */
   20.96 -    public synchronized void write(int b) throws IOException {
   20.97 -        if (count >= buf.length) {
   20.98 -            flushBuffer();
   20.99 -        }
  20.100 -        buf[count++] = (byte)b;
  20.101 -    }
  20.102 -
  20.103 -    /**
  20.104 -     * Writes <code>len</code> bytes from the specified byte array
  20.105 -     * starting at offset <code>off</code> to this buffered output stream.
  20.106 -     *
  20.107 -     * <p> Ordinarily this method stores bytes from the given array into this
  20.108 -     * stream's buffer, flushing the buffer to the underlying output stream as
  20.109 -     * needed.  If the requested length is at least as large as this stream's
  20.110 -     * buffer, however, then this method will flush the buffer and write the
  20.111 -     * bytes directly to the underlying output stream.  Thus redundant
  20.112 -     * <code>BufferedOutputStream</code>s will not copy data unnecessarily.
  20.113 -     *
  20.114 -     * @param      b     the data.
  20.115 -     * @param      off   the start offset in the data.
  20.116 -     * @param      len   the number of bytes to write.
  20.117 -     * @exception  IOException  if an I/O error occurs.
  20.118 -     */
  20.119 -    public synchronized void write(byte b[], int off, int len) throws IOException {
  20.120 -        if (len >= buf.length) {
  20.121 -            /* If the request length exceeds the size of the output buffer,
  20.122 -               flush the output buffer and then write the data directly.
  20.123 -               In this way buffered streams will cascade harmlessly. */
  20.124 -            flushBuffer();
  20.125 -            out.write(b, off, len);
  20.126 -            return;
  20.127 -        }
  20.128 -        if (len > buf.length - count) {
  20.129 -            flushBuffer();
  20.130 -        }
  20.131 -        System.arraycopy(b, off, buf, count, len);
  20.132 -        count += len;
  20.133 -    }
  20.134 -
  20.135 -    /**
  20.136 -     * Flushes this buffered output stream. This forces any buffered
  20.137 -     * output bytes to be written out to the underlying output stream.
  20.138 -     *
  20.139 -     * @exception  IOException  if an I/O error occurs.
  20.140 -     * @see        java.io.FilterOutputStream#out
  20.141 -     */
  20.142 -    public synchronized void flush() throws IOException {
  20.143 -        flushBuffer();
  20.144 -        out.flush();
  20.145 -    }
  20.146 -}
    21.1 --- a/emul/compact/src/main/java/java/io/BufferedReader.java	Mon Feb 25 19:00:08 2013 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,523 +0,0 @@
    21.4 -/*
    21.5 - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
    21.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 - *
    21.8 - * This code is free software; you can redistribute it and/or modify it
    21.9 - * under the terms of the GNU General Public License version 2 only, as
   21.10 - * published by the Free Software Foundation.  Oracle designates this
   21.11 - * particular file as subject to the "Classpath" exception as provided
   21.12 - * by Oracle in the LICENSE file that accompanied this code.
   21.13 - *
   21.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   21.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.17 - * version 2 for more details (a copy is included in the LICENSE file that
   21.18 - * accompanied this code).
   21.19 - *
   21.20 - * You should have received a copy of the GNU General Public License version
   21.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   21.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.23 - *
   21.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.25 - * or visit www.oracle.com if you need additional information or have any
   21.26 - * questions.
   21.27 - */
   21.28 -
   21.29 -package java.io;
   21.30 -
   21.31 -
   21.32 -
   21.33 -/**
   21.34 - * Reads text from a character-input stream, buffering characters so as to
   21.35 - * provide for the efficient reading of characters, arrays, and lines.
   21.36 - *
   21.37 - * <p> The buffer size may be specified, or the default size may be used.  The
   21.38 - * default is large enough for most purposes.
   21.39 - *
   21.40 - * <p> In general, each read request made of a Reader causes a corresponding
   21.41 - * read request to be made of the underlying character or byte stream.  It is
   21.42 - * therefore advisable to wrap a BufferedReader around any Reader whose read()
   21.43 - * operations may be costly, such as FileReaders and InputStreamReaders.  For
   21.44 - * example,
   21.45 - *
   21.46 - * <pre>
   21.47 - * BufferedReader in
   21.48 - *   = new BufferedReader(new FileReader("foo.in"));
   21.49 - * </pre>
   21.50 - *
   21.51 - * will buffer the input from the specified file.  Without buffering, each
   21.52 - * invocation of read() or readLine() could cause bytes to be read from the
   21.53 - * file, converted into characters, and then returned, which can be very
   21.54 - * inefficient.
   21.55 - *
   21.56 - * <p> Programs that use DataInputStreams for textual input can be localized by
   21.57 - * replacing each DataInputStream with an appropriate BufferedReader.
   21.58 - *
   21.59 - * @see FileReader
   21.60 - * @see InputStreamReader
   21.61 - * @see java.nio.file.Files#newBufferedReader
   21.62 - *
   21.63 - * @author      Mark Reinhold
   21.64 - * @since       JDK1.1
   21.65 - */
   21.66 -
   21.67 -public class BufferedReader extends Reader {
   21.68 -
   21.69 -    private Reader in;
   21.70 -
   21.71 -    private char cb[];
   21.72 -    private int nChars, nextChar;
   21.73 -
   21.74 -    private static final int INVALIDATED = -2;
   21.75 -    private static final int UNMARKED = -1;
   21.76 -    private int markedChar = UNMARKED;
   21.77 -    private int readAheadLimit = 0; /* Valid only when markedChar > 0 */
   21.78 -
   21.79 -    /** If the next character is a line feed, skip it */
   21.80 -    private boolean skipLF = false;
   21.81 -
   21.82 -    /** The skipLF flag when the mark was set */
   21.83 -    private boolean markedSkipLF = false;
   21.84 -
   21.85 -    private static int defaultCharBufferSize = 8192;
   21.86 -    private static int defaultExpectedLineLength = 80;
   21.87 -
   21.88 -    /**
   21.89 -     * Creates a buffering character-input stream that uses an input buffer of
   21.90 -     * the specified size.
   21.91 -     *
   21.92 -     * @param  in   A Reader
   21.93 -     * @param  sz   Input-buffer size
   21.94 -     *
   21.95 -     * @exception  IllegalArgumentException  If sz is <= 0
   21.96 -     */
   21.97 -    public BufferedReader(Reader in, int sz) {
   21.98 -        super(in);
   21.99 -        if (sz <= 0)
  21.100 -            throw new IllegalArgumentException("Buffer size <= 0");
  21.101 -        this.in = in;
  21.102 -        cb = new char[sz];
  21.103 -        nextChar = nChars = 0;
  21.104 -    }
  21.105 -
  21.106 -    /**
  21.107 -     * Creates a buffering character-input stream that uses a default-sized
  21.108 -     * input buffer.
  21.109 -     *
  21.110 -     * @param  in   A Reader
  21.111 -     */
  21.112 -    public BufferedReader(Reader in) {
  21.113 -        this(in, defaultCharBufferSize);
  21.114 -    }
  21.115 -
  21.116 -    /** Checks to make sure that the stream has not been closed */
  21.117 -    private void ensureOpen() throws IOException {
  21.118 -        if (in == null)
  21.119 -            throw new IOException("Stream closed");
  21.120 -    }
  21.121 -
  21.122 -    /**
  21.123 -     * Fills the input buffer, taking the mark into account if it is valid.
  21.124 -     */
  21.125 -    private void fill() throws IOException {
  21.126 -        int dst;
  21.127 -        if (markedChar <= UNMARKED) {
  21.128 -            /* No mark */
  21.129 -            dst = 0;
  21.130 -        } else {
  21.131 -            /* Marked */
  21.132 -            int delta = nextChar - markedChar;
  21.133 -            if (delta >= readAheadLimit) {
  21.134 -                /* Gone past read-ahead limit: Invalidate mark */
  21.135 -                markedChar = INVALIDATED;
  21.136 -                readAheadLimit = 0;
  21.137 -                dst = 0;
  21.138 -            } else {
  21.139 -                if (readAheadLimit <= cb.length) {
  21.140 -                    /* Shuffle in the current buffer */
  21.141 -                    System.arraycopy(cb, markedChar, cb, 0, delta);
  21.142 -                    markedChar = 0;
  21.143 -                    dst = delta;
  21.144 -                } else {
  21.145 -                    /* Reallocate buffer to accommodate read-ahead limit */
  21.146 -                    char ncb[] = new char[readAheadLimit];
  21.147 -                    System.arraycopy(cb, markedChar, ncb, 0, delta);
  21.148 -                    cb = ncb;
  21.149 -                    markedChar = 0;
  21.150 -                    dst = delta;
  21.151 -                }
  21.152 -                nextChar = nChars = delta;
  21.153 -            }
  21.154 -        }
  21.155 -
  21.156 -        int n;
  21.157 -        do {
  21.158 -            n = in.read(cb, dst, cb.length - dst);
  21.159 -        } while (n == 0);
  21.160 -        if (n > 0) {
  21.161 -            nChars = dst + n;
  21.162 -            nextChar = dst;
  21.163 -        }
  21.164 -    }
  21.165 -
  21.166 -    /**
  21.167 -     * Reads a single character.
  21.168 -     *
  21.169 -     * @return The character read, as an integer in the range
  21.170 -     *         0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
  21.171 -     *         end of the stream has been reached
  21.172 -     * @exception  IOException  If an I/O error occurs
  21.173 -     */
  21.174 -    public int read() throws IOException {
  21.175 -        synchronized (lock) {
  21.176 -            ensureOpen();
  21.177 -            for (;;) {
  21.178 -                if (nextChar >= nChars) {
  21.179 -                    fill();
  21.180 -                    if (nextChar >= nChars)
  21.181 -                        return -1;
  21.182 -                }
  21.183 -                if (skipLF) {
  21.184 -                    skipLF = false;
  21.185 -                    if (cb[nextChar] == '\n') {
  21.186 -                        nextChar++;
  21.187 -                        continue;
  21.188 -                    }
  21.189 -                }
  21.190 -                return cb[nextChar++];
  21.191 -            }
  21.192 -        }
  21.193 -    }
  21.194 -
  21.195 -    /**
  21.196 -     * Reads characters into a portion of an array, reading from the underlying
  21.197 -     * stream if necessary.
  21.198 -     */
  21.199 -    private int read1(char[] cbuf, int off, int len) throws IOException {
  21.200 -        if (nextChar >= nChars) {
  21.201 -            /* If the requested length is at least as large as the buffer, and
  21.202 -               if there is no mark/reset activity, and if line feeds are not
  21.203 -               being skipped, do not bother to copy the characters into the
  21.204 -               local buffer.  In this way buffered streams will cascade
  21.205 -               harmlessly. */
  21.206 -            if (len >= cb.length && markedChar <= UNMARKED && !skipLF) {
  21.207 -                return in.read(cbuf, off, len);
  21.208 -            }
  21.209 -            fill();
  21.210 -        }
  21.211 -        if (nextChar >= nChars) return -1;
  21.212 -        if (skipLF) {
  21.213 -            skipLF = false;
  21.214 -            if (cb[nextChar] == '\n') {
  21.215 -                nextChar++;
  21.216 -                if (nextChar >= nChars)
  21.217 -                    fill();
  21.218 -                if (nextChar >= nChars)
  21.219 -                    return -1;
  21.220 -            }
  21.221 -        }
  21.222 -        int n = Math.min(len, nChars - nextChar);
  21.223 -        System.arraycopy(cb, nextChar, cbuf, off, n);
  21.224 -        nextChar += n;
  21.225 -        return n;
  21.226 -    }
  21.227 -
  21.228 -    /**
  21.229 -     * Reads characters into a portion of an array.
  21.230 -     *
  21.231 -     * <p> This method implements the general contract of the corresponding
  21.232 -     * <code>{@link Reader#read(char[], int, int) read}</code> method of the
  21.233 -     * <code>{@link Reader}</code> class.  As an additional convenience, it
  21.234 -     * attempts to read as many characters as possible by repeatedly invoking
  21.235 -     * the <code>read</code> method of the underlying stream.  This iterated
  21.236 -     * <code>read</code> continues until one of the following conditions becomes
  21.237 -     * true: <ul>
  21.238 -     *
  21.239 -     *   <li> The specified number of characters have been read,
  21.240 -     *
  21.241 -     *   <li> The <code>read</code> method of the underlying stream returns
  21.242 -     *   <code>-1</code>, indicating end-of-file, or
  21.243 -     *
  21.244 -     *   <li> The <code>ready</code> method of the underlying stream
  21.245 -     *   returns <code>false</code>, indicating that further input requests
  21.246 -     *   would block.
  21.247 -     *
  21.248 -     * </ul> If the first <code>read</code> on the underlying stream returns
  21.249 -     * <code>-1</code> to indicate end-of-file then this method returns
  21.250 -     * <code>-1</code>.  Otherwise this method returns the number of characters
  21.251 -     * actually read.
  21.252 -     *
  21.253 -     * <p> Subclasses of this class are encouraged, but not required, to
  21.254 -     * attempt to read as many characters as possible in the same fashion.
  21.255 -     *
  21.256 -     * <p> Ordinarily this method takes characters from this stream's character
  21.257 -     * buffer, filling it from the underlying stream as necessary.  If,
  21.258 -     * however, the buffer is empty, the mark is not valid, and the requested
  21.259 -     * length is at least as large as the buffer, then this method will read
  21.260 -     * characters directly from the underlying stream into the given array.
  21.261 -     * Thus redundant <code>BufferedReader</code>s will not copy data
  21.262 -     * unnecessarily.
  21.263 -     *
  21.264 -     * @param      cbuf  Destination buffer
  21.265 -     * @param      off   Offset at which to start storing characters
  21.266 -     * @param      len   Maximum number of characters to read
  21.267 -     *
  21.268 -     * @return     The number of characters read, or -1 if the end of the
  21.269 -     *             stream has been reached
  21.270 -     *
  21.271 -     * @exception  IOException  If an I/O error occurs
  21.272 -     */
  21.273 -    public int read(char cbuf[], int off, int len) throws IOException {
  21.274 -        synchronized (lock) {
  21.275 -            ensureOpen();
  21.276 -            if ((off < 0) || (off > cbuf.length) || (len < 0) ||
  21.277 -                ((off + len) > cbuf.length) || ((off + len) < 0)) {
  21.278 -                throw new IndexOutOfBoundsException();
  21.279 -            } else if (len == 0) {
  21.280 -                return 0;
  21.281 -            }
  21.282 -
  21.283 -            int n = read1(cbuf, off, len);
  21.284 -            if (n <= 0) return n;
  21.285 -            while ((n < len) && in.ready()) {
  21.286 -                int n1 = read1(cbuf, off + n, len - n);
  21.287 -                if (n1 <= 0) break;
  21.288 -                n += n1;
  21.289 -            }
  21.290 -            return n;
  21.291 -        }
  21.292 -    }
  21.293 -
  21.294 -    /**
  21.295 -     * Reads a line of text.  A line is considered to be terminated by any one
  21.296 -     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
  21.297 -     * followed immediately by a linefeed.
  21.298 -     *
  21.299 -     * @param      ignoreLF  If true, the next '\n' will be skipped
  21.300 -     *
  21.301 -     * @return     A String containing the contents of the line, not including
  21.302 -     *             any line-termination characters, or null if the end of the
  21.303 -     *             stream has been reached
  21.304 -     *
  21.305 -     * @see        java.io.LineNumberReader#readLine()
  21.306 -     *
  21.307 -     * @exception  IOException  If an I/O error occurs
  21.308 -     */
  21.309 -    String readLine(boolean ignoreLF) throws IOException {
  21.310 -        StringBuffer s = null;
  21.311 -        int startChar;
  21.312 -
  21.313 -        synchronized (lock) {
  21.314 -            ensureOpen();
  21.315 -            boolean omitLF = ignoreLF || skipLF;
  21.316 -
  21.317 -        bufferLoop:
  21.318 -            for (;;) {
  21.319 -
  21.320 -                if (nextChar >= nChars)
  21.321 -                    fill();
  21.322 -                if (nextChar >= nChars) { /* EOF */
  21.323 -                    if (s != null && s.length() > 0)
  21.324 -                        return s.toString();
  21.325 -                    else
  21.326 -                        return null;
  21.327 -                }
  21.328 -                boolean eol = false;
  21.329 -                char c = 0;
  21.330 -                int i;
  21.331 -
  21.332 -                /* Skip a leftover '\n', if necessary */
  21.333 -                if (omitLF && (cb[nextChar] == '\n'))
  21.334 -                    nextChar++;
  21.335 -                skipLF = false;
  21.336 -                omitLF = false;
  21.337 -
  21.338 -            charLoop:
  21.339 -                for (i = nextChar; i < nChars; i++) {
  21.340 -                    c = cb[i];
  21.341 -                    if ((c == '\n') || (c == '\r')) {
  21.342 -                        eol = true;
  21.343 -                        break charLoop;
  21.344 -                    }
  21.345 -                }
  21.346 -
  21.347 -                startChar = nextChar;
  21.348 -                nextChar = i;
  21.349 -
  21.350 -                if (eol) {
  21.351 -                    String str;
  21.352 -                    if (s == null) {
  21.353 -                        str = new String(cb, startChar, i - startChar);
  21.354 -                    } else {
  21.355 -                        s.append(cb, startChar, i - startChar);
  21.356 -                        str = s.toString();
  21.357 -                    }
  21.358 -                    nextChar++;
  21.359 -                    if (c == '\r') {
  21.360 -                        skipLF = true;
  21.361 -                    }
  21.362 -                    return str;
  21.363 -                }
  21.364 -
  21.365 -                if (s == null)
  21.366 -                    s = new StringBuffer(defaultExpectedLineLength);
  21.367 -                s.append(cb, startChar, i - startChar);
  21.368 -            }
  21.369 -        }
  21.370 -    }
  21.371 -
  21.372 -    /**
  21.373 -     * Reads a line of text.  A line is considered to be terminated by any one
  21.374 -     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
  21.375 -     * followed immediately by a linefeed.
  21.376 -     *
  21.377 -     * @return     A String containing the contents of the line, not including
  21.378 -     *             any line-termination characters, or null if the end of the
  21.379 -     *             stream has been reached
  21.380 -     *
  21.381 -     * @exception  IOException  If an I/O error occurs
  21.382 -     *
  21.383 -     * @see java.nio.file.Files#readAllLines
  21.384 -     */
  21.385 -    public String readLine() throws IOException {
  21.386 -        return readLine(false);
  21.387 -    }
  21.388 -
  21.389 -    /**
  21.390 -     * Skips characters.
  21.391 -     *
  21.392 -     * @param  n  The number of characters to skip
  21.393 -     *
  21.394 -     * @return    The number of characters actually skipped
  21.395 -     *
  21.396 -     * @exception  IllegalArgumentException  If <code>n</code> is negative.
  21.397 -     * @exception  IOException  If an I/O error occurs
  21.398 -     */
  21.399 -    public long skip(long n) throws IOException {
  21.400 -        if (n < 0L) {
  21.401 -            throw new IllegalArgumentException("skip value is negative");
  21.402 -        }
  21.403 -        synchronized (lock) {
  21.404 -            ensureOpen();
  21.405 -            long r = n;
  21.406 -            while (r > 0) {
  21.407 -                if (nextChar >= nChars)
  21.408 -                    fill();
  21.409 -                if (nextChar >= nChars) /* EOF */
  21.410 -                    break;
  21.411 -                if (skipLF) {
  21.412 -                    skipLF = false;
  21.413 -                    if (cb[nextChar] == '\n') {
  21.414 -                        nextChar++;
  21.415 -                    }
  21.416 -                }
  21.417 -                long d = nChars - nextChar;
  21.418 -                if (r <= d) {
  21.419 -                    nextChar += r;
  21.420 -                    r = 0;
  21.421 -                    break;
  21.422 -                }
  21.423 -                else {
  21.424 -                    r -= d;
  21.425 -                    nextChar = nChars;
  21.426 -                }
  21.427 -            }
  21.428 -            return n - r;
  21.429 -        }
  21.430 -    }
  21.431 -
  21.432 -    /**
  21.433 -     * Tells whether this stream is ready to be read.  A buffered character
  21.434 -     * stream is ready if the buffer is not empty, or if the underlying
  21.435 -     * character stream is ready.
  21.436 -     *
  21.437 -     * @exception  IOException  If an I/O error occurs
  21.438 -     */
  21.439 -    public boolean ready() throws IOException {
  21.440 -        synchronized (lock) {
  21.441 -            ensureOpen();
  21.442 -
  21.443 -            /*
  21.444 -             * If newline needs to be skipped and the next char to be read
  21.445 -             * is a newline character, then just skip it right away.
  21.446 -             */
  21.447 -            if (skipLF) {
  21.448 -                /* Note that in.ready() will return true if and only if the next
  21.449 -                 * read on the stream will not block.
  21.450 -                 */
  21.451 -                if (nextChar >= nChars && in.ready()) {
  21.452 -                    fill();
  21.453 -                }
  21.454 -                if (nextChar < nChars) {
  21.455 -                    if (cb[nextChar] == '\n')
  21.456 -                        nextChar++;
  21.457 -                    skipLF = false;
  21.458 -                }
  21.459 -            }
  21.460 -            return (nextChar < nChars) || in.ready();
  21.461 -        }
  21.462 -    }
  21.463 -
  21.464 -    /**
  21.465 -     * Tells whether this stream supports the mark() operation, which it does.
  21.466 -     */
  21.467 -    public boolean markSupported() {
  21.468 -        return true;
  21.469 -    }
  21.470 -
  21.471 -    /**
  21.472 -     * Marks the present position in the stream.  Subsequent calls to reset()
  21.473 -     * will attempt to reposition the stream to this point.
  21.474 -     *
  21.475 -     * @param readAheadLimit   Limit on the number of characters that may be
  21.476 -     *                         read while still preserving the mark. An attempt
  21.477 -     *                         to reset the stream after reading characters
  21.478 -     *                         up to this limit or beyond may fail.
  21.479 -     *                         A limit value larger than the size of the input
  21.480 -     *                         buffer will cause a new buffer to be allocated
  21.481 -     *                         whose size is no smaller than limit.
  21.482 -     *                         Therefore large values should be used with care.
  21.483 -     *
  21.484 -     * @exception  IllegalArgumentException  If readAheadLimit is < 0
  21.485 -     * @exception  IOException  If an I/O error occurs
  21.486 -     */
  21.487 -    public void mark(int readAheadLimit) throws IOException {
  21.488 -        if (readAheadLimit < 0) {
  21.489 -            throw new IllegalArgumentException("Read-ahead limit < 0");
  21.490 -        }
  21.491 -        synchronized (lock) {
  21.492 -            ensureOpen();
  21.493 -            this.readAheadLimit = readAheadLimit;
  21.494 -            markedChar = nextChar;
  21.495 -            markedSkipLF = skipLF;
  21.496 -        }
  21.497 -    }
  21.498 -
  21.499 -    /**
  21.500 -     * Resets the stream to the most recent mark.
  21.501 -     *
  21.502 -     * @exception  IOException  If the stream has never been marked,
  21.503 -     *                          or if the mark has been invalidated
  21.504 -     */
  21.505 -    public void reset() throws IOException {
  21.506 -        synchronized (lock) {
  21.507 -            ensureOpen();
  21.508 -            if (markedChar < 0)
  21.509 -                throw new IOException((markedChar == INVALIDATED)
  21.510 -                                      ? "Mark invalid"
  21.511 -                                      : "Stream not marked");
  21.512 -            nextChar = markedChar;
  21.513 -            skipLF = markedSkipLF;
  21.514 -        }
  21.515 -    }
  21.516 -
  21.517 -    public void close() throws IOException {
  21.518 -        synchronized (lock) {
  21.519 -            if (in == null)
  21.520 -                return;
  21.521 -            in.close();
  21.522 -            in = null;
  21.523 -            cb = null;
  21.524 -        }
  21.525 -    }
  21.526 -}
    22.1 --- a/emul/compact/src/main/java/java/io/ByteArrayOutputStream.java	Mon Feb 25 19:00:08 2013 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,272 +0,0 @@
    22.4 -/*
    22.5 - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 - *
    22.8 - * This code is free software; you can redistribute it and/or modify it
    22.9 - * under the terms of the GNU General Public License version 2 only, as
   22.10 - * published by the Free Software Foundation.  Oracle designates this
   22.11 - * particular file as subject to the "Classpath" exception as provided
   22.12 - * by Oracle in the LICENSE file that accompanied this code.
   22.13 - *
   22.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   22.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.17 - * version 2 for more details (a copy is included in the LICENSE file that
   22.18 - * accompanied this code).
   22.19 - *
   22.20 - * You should have received a copy of the GNU General Public License version
   22.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   22.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.23 - *
   22.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.25 - * or visit www.oracle.com if you need additional information or have any
   22.26 - * questions.
   22.27 - */
   22.28 -
   22.29 -package java.io;
   22.30 -
   22.31 -import java.util.Arrays;
   22.32 -
   22.33 -/**
   22.34 - * This class implements an output stream in which the data is
   22.35 - * written into a byte array. The buffer automatically grows as data
   22.36 - * is written to it.
   22.37 - * The data can be retrieved using <code>toByteArray()</code> and
   22.38 - * <code>toString()</code>.
   22.39 - * <p>
   22.40 - * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
   22.41 - * this class can be called after the stream has been closed without
   22.42 - * generating an <tt>IOException</tt>.
   22.43 - *
   22.44 - * @author  Arthur van Hoff
   22.45 - * @since   JDK1.0
   22.46 - */
   22.47 -
   22.48 -public class ByteArrayOutputStream extends OutputStream {
   22.49 -
   22.50 -    /**
   22.51 -     * The buffer where data is stored.
   22.52 -     */
   22.53 -    protected byte buf[];
   22.54 -
   22.55 -    /**
   22.56 -     * The number of valid bytes in the buffer.
   22.57 -     */
   22.58 -    protected int count;
   22.59 -
   22.60 -    /**
   22.61 -     * Creates a new byte array output stream. The buffer capacity is
   22.62 -     * initially 32 bytes, though its size increases if necessary.
   22.63 -     */
   22.64 -    public ByteArrayOutputStream() {
   22.65 -        this(32);
   22.66 -    }
   22.67 -
   22.68 -    /**
   22.69 -     * Creates a new byte array output stream, with a buffer capacity of
   22.70 -     * the specified size, in bytes.
   22.71 -     *
   22.72 -     * @param   size   the initial size.
   22.73 -     * @exception  IllegalArgumentException if size is negative.
   22.74 -     */
   22.75 -    public ByteArrayOutputStream(int size) {
   22.76 -        if (size < 0) {
   22.77 -            throw new IllegalArgumentException("Negative initial size: "
   22.78 -                                               + size);
   22.79 -        }
   22.80 -        buf = new byte[size];
   22.81 -    }
   22.82 -
   22.83 -    /**
   22.84 -     * Increases the capacity if necessary to ensure that it can hold
   22.85 -     * at least the number of elements specified by the minimum
   22.86 -     * capacity argument.
   22.87 -     *
   22.88 -     * @param minCapacity the desired minimum capacity
   22.89 -     * @throws OutOfMemoryError if {@code minCapacity < 0}.  This is
   22.90 -     * interpreted as a request for the unsatisfiably large capacity
   22.91 -     * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.
   22.92 -     */
   22.93 -    private void ensureCapacity(int minCapacity) {
   22.94 -        // overflow-conscious code
   22.95 -        if (minCapacity - buf.length > 0)
   22.96 -            grow(minCapacity);
   22.97 -    }
   22.98 -
   22.99 -    /**
  22.100 -     * Increases the capacity to ensure that it can hold at least the
  22.101 -     * number of elements specified by the minimum capacity argument.
  22.102 -     *
  22.103 -     * @param minCapacity the desired minimum capacity
  22.104 -     */
  22.105 -    private void grow(int minCapacity) {
  22.106 -        // overflow-conscious code
  22.107 -        int oldCapacity = buf.length;
  22.108 -        int newCapacity = oldCapacity << 1;
  22.109 -        if (newCapacity - minCapacity < 0)
  22.110 -            newCapacity = minCapacity;
  22.111 -        if (newCapacity < 0) {
  22.112 -            if (minCapacity < 0) // overflow
  22.113 -                throw new OutOfMemoryError();
  22.114 -            newCapacity = Integer.MAX_VALUE;
  22.115 -        }
  22.116 -        buf = Arrays.copyOf(buf, newCapacity);
  22.117 -    }
  22.118 -
  22.119 -    /**
  22.120 -     * Writes the specified byte to this byte array output stream.
  22.121 -     *
  22.122 -     * @param   b   the byte to be written.
  22.123 -     */
  22.124 -    public synchronized void write(int b) {
  22.125 -        ensureCapacity(count + 1);
  22.126 -        buf[count] = (byte) b;
  22.127 -        count += 1;
  22.128 -    }
  22.129 -
  22.130 -    /**
  22.131 -     * Writes <code>len</code> bytes from the specified byte array
  22.132 -     * starting at offset <code>off</code> to this byte array output stream.
  22.133 -     *
  22.134 -     * @param   b     the data.
  22.135 -     * @param   off   the start offset in the data.
  22.136 -     * @param   len   the number of bytes to write.
  22.137 -     */
  22.138 -    public synchronized void write(byte b[], int off, int len) {
  22.139 -        if ((off < 0) || (off > b.length) || (len < 0) ||
  22.140 -            ((off + len) - b.length > 0)) {
  22.141 -            throw new IndexOutOfBoundsException();
  22.142 -        }
  22.143 -        ensureCapacity(count + len);
  22.144 -        System.arraycopy(b, off, buf, count, len);
  22.145 -        count += len;
  22.146 -    }
  22.147 -
  22.148 -    /**
  22.149 -     * Writes the complete contents of this byte array output stream to
  22.150 -     * the specified output stream argument, as if by calling the output
  22.151 -     * stream's write method using <code>out.write(buf, 0, count)</code>.
  22.152 -     *
  22.153 -     * @param      out   the output stream to which to write the data.
  22.154 -     * @exception  IOException  if an I/O error occurs.
  22.155 -     */
  22.156 -    public synchronized void writeTo(OutputStream out) throws IOException {
  22.157 -        out.write(buf, 0, count);
  22.158 -    }
  22.159 -
  22.160 -    /**
  22.161 -     * Resets the <code>count</code> field of this byte array output
  22.162 -     * stream to zero, so that all currently accumulated output in the
  22.163 -     * output stream is discarded. The output stream can be used again,
  22.164 -     * reusing the already allocated buffer space.
  22.165 -     *
  22.166 -     * @see     java.io.ByteArrayInputStream#count
  22.167 -     */
  22.168 -    public synchronized void reset() {
  22.169 -        count = 0;
  22.170 -    }
  22.171 -
  22.172 -    /**
  22.173 -     * Creates a newly allocated byte array. Its size is the current
  22.174 -     * size of this output stream and the valid contents of the buffer
  22.175 -     * have been copied into it.
  22.176 -     *
  22.177 -     * @return  the current contents of this output stream, as a byte array.
  22.178 -     * @see     java.io.ByteArrayOutputStream#size()
  22.179 -     */
  22.180 -    public synchronized byte toByteArray()[] {
  22.181 -        return Arrays.copyOf(buf, count);
  22.182 -    }
  22.183 -
  22.184 -    /**
  22.185 -     * Returns the current size of the buffer.
  22.186 -     *
  22.187 -     * @return  the value of the <code>count</code> field, which is the number
  22.188 -     *          of valid bytes in this output stream.
  22.189 -     * @see     java.io.ByteArrayOutputStream#count
  22.190 -     */
  22.191 -    public synchronized int size() {
  22.192 -        return count;
  22.193 -    }
  22.194 -
  22.195 -    /**
  22.196 -     * Converts the buffer's contents into a string decoding bytes using the
  22.197 -     * platform's default character set. The length of the new <tt>String</tt>
  22.198 -     * is a function of the character set, and hence may not be equal to the
  22.199 -     * size of the buffer.
  22.200 -     *
  22.201 -     * <p> This method always replaces malformed-input and unmappable-character
  22.202 -     * sequences with the default replacement string for the platform's
  22.203 -     * default character set. The {@linkplain java.nio.charset.CharsetDecoder}
  22.204 -     * class should be used when more control over the decoding process is
  22.205 -     * required.
  22.206 -     *
  22.207 -     * @return String decoded from the buffer's contents.
  22.208 -     * @since  JDK1.1
  22.209 -     */
  22.210 -    public synchronized String toString() {
  22.211 -        return new String(buf, 0, count);
  22.212 -    }
  22.213 -
  22.214 -    /**
  22.215 -     * Converts the buffer's contents into a string by decoding the bytes using
  22.216 -     * the specified {@link java.nio.charset.Charset charsetName}. The length of
  22.217 -     * the new <tt>String</tt> is a function of the charset, and hence may not be
  22.218 -     * equal to the length of the byte array.
  22.219 -     *
  22.220 -     * <p> This method always replaces malformed-input and unmappable-character
  22.221 -     * sequences with this charset's default replacement string. The {@link
  22.222 -     * java.nio.charset.CharsetDecoder} class should be used when more control
  22.223 -     * over the decoding process is required.
  22.224 -     *
  22.225 -     * @param  charsetName  the name of a supported
  22.226 -     *              {@linkplain java.nio.charset.Charset </code>charset<code>}
  22.227 -     * @return String decoded from the buffer's contents.
  22.228 -     * @exception  UnsupportedEncodingException
  22.229 -     *             If the named charset is not supported
  22.230 -     * @since   JDK1.1
  22.231 -     */
  22.232 -    public synchronized String toString(String charsetName)
  22.233 -        throws UnsupportedEncodingException
  22.234 -    {
  22.235 -        return new String(buf, 0, count, charsetName);
  22.236 -    }
  22.237 -
  22.238 -    /**
  22.239 -     * Creates a newly allocated string. Its size is the current size of
  22.240 -     * the output stream and the valid contents of the buffer have been
  22.241 -     * copied into it. Each character <i>c</i> in the resulting string is
  22.242 -     * constructed from the corresponding element <i>b</i> in the byte
  22.243 -     * array such that:
  22.244 -     * <blockquote><pre>
  22.245 -     *     c == (char)(((hibyte &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
  22.246 -     * </pre></blockquote>
  22.247 -     *
  22.248 -     * @deprecated This method does not properly convert bytes into characters.
  22.249 -     * As of JDK&nbsp;1.1, the preferred way to do this is via the
  22.250 -     * <code>toString(String enc)</code> method, which takes an encoding-name
  22.251 -     * argument, or the <code>toString()</code> method, which uses the
  22.252 -     * platform's default character encoding.
  22.253 -     *
  22.254 -     * @param      hibyte    the high byte of each resulting Unicode character.
  22.255 -     * @return     the current contents of the output stream, as a string.
  22.256 -     * @see        java.io.ByteArrayOutputStream#size()
  22.257 -     * @see        java.io.ByteArrayOutputStream#toString(String)
  22.258 -     * @see        java.io.ByteArrayOutputStream#toString()
  22.259 -     */
  22.260 -    @Deprecated
  22.261 -    public synchronized String toString(int hibyte) {
  22.262 -        return new String(buf, hibyte, 0, count);
  22.263 -    }
  22.264 -
  22.265 -    /**
  22.266 -     * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
  22.267 -     * this class can be called after the stream has been closed without
  22.268 -     * generating an <tt>IOException</tt>.
  22.269 -     * <p>
  22.270 -     *
  22.271 -     */
  22.272 -    public void close() throws IOException {
  22.273 -    }
  22.274 -
  22.275 -}
    23.1 --- a/emul/compact/src/main/java/java/io/DataOutput.java	Mon Feb 25 19:00:08 2013 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,354 +0,0 @@
    23.4 -/*
    23.5 - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
    23.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 - *
    23.8 - * This code is free software; you can redistribute it and/or modify it
    23.9 - * under the terms of the GNU General Public License version 2 only, as
   23.10 - * published by the Free Software Foundation.  Oracle designates this
   23.11 - * particular file as subject to the "Classpath" exception as provided
   23.12 - * by Oracle in the LICENSE file that accompanied this code.
   23.13 - *
   23.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   23.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.17 - * version 2 for more details (a copy is included in the LICENSE file that
   23.18 - * accompanied this code).
   23.19 - *
   23.20 - * You should have received a copy of the GNU General Public License version
   23.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   23.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.23 - *
   23.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.25 - * or visit www.oracle.com if you need additional information or have any
   23.26 - * questions.
   23.27 - */
   23.28 -
   23.29 -package java.io;
   23.30 -
   23.31 -/**
   23.32 - * The <code>DataOutput</code> interface provides
   23.33 - * for converting data from any of the Java
   23.34 - * primitive types to a series of bytes and
   23.35 - * writing these bytes to a binary stream.
   23.36 - * There is  also a facility for converting
   23.37 - * a <code>String</code> into
   23.38 - * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
   23.39 - * format and writing the resulting series
   23.40 - * of bytes.
   23.41 - * <p>
   23.42 - * For all the methods in this interface that
   23.43 - * write bytes, it is generally true that if
   23.44 - * a byte cannot be written for any reason,
   23.45 - * an <code>IOException</code> is thrown.
   23.46 - *
   23.47 - * @author  Frank Yellin
   23.48 - * @see     java.io.DataInput
   23.49 - * @see     java.io.DataOutputStream
   23.50 - * @since   JDK1.0
   23.51 - */
   23.52 -public
   23.53 -interface DataOutput {
   23.54 -    /**
   23.55 -     * Writes to the output stream the eight
   23.56 -     * low-order bits of the argument <code>b</code>.
   23.57 -     * The 24 high-order  bits of <code>b</code>
   23.58 -     * are ignored.
   23.59 -     *
   23.60 -     * @param      b   the byte to be written.
   23.61 -     * @throws     IOException  if an I/O error occurs.
   23.62 -     */
   23.63 -    void write(int b) throws IOException;
   23.64 -
   23.65 -    /**
   23.66 -     * Writes to the output stream all the bytes in array <code>b</code>.
   23.67 -     * If <code>b</code> is <code>null</code>,
   23.68 -     * a <code>NullPointerException</code> is thrown.
   23.69 -     * If <code>b.length</code> is zero, then
   23.70 -     * no bytes are written. Otherwise, the byte
   23.71 -     * <code>b[0]</code> is written first, then
   23.72 -     * <code>b[1]</code>, and so on; the last byte
   23.73 -     * written is <code>b[b.length-1]</code>.
   23.74 -     *
   23.75 -     * @param      b   the data.
   23.76 -     * @throws     IOException  if an I/O error occurs.
   23.77 -     */
   23.78 -    void write(byte b[]) throws IOException;
   23.79 -
   23.80 -    /**
   23.81 -     * Writes <code>len</code> bytes from array
   23.82 -     * <code>b</code>, in order,  to
   23.83 -     * the output stream.  If <code>b</code>
   23.84 -     * is <code>null</code>, a <code>NullPointerException</code>
   23.85 -     * is thrown.  If <code>off</code> is negative,
   23.86 -     * or <code>len</code> is negative, or <code>off+len</code>
   23.87 -     * is greater than the length of the array
   23.88 -     * <code>b</code>, then an <code>IndexOutOfBoundsException</code>
   23.89 -     * is thrown.  If <code>len</code> is zero,
   23.90 -     * then no bytes are written. Otherwise, the
   23.91 -     * byte <code>b[off]</code> is written first,
   23.92 -     * then <code>b[off+1]</code>, and so on; the
   23.93 -     * last byte written is <code>b[off+len-1]</code>.
   23.94 -     *
   23.95 -     * @param      b     the data.
   23.96 -     * @param      off   the start offset in the data.
   23.97 -     * @param      len   the number of bytes to write.
   23.98 -     * @throws     IOException  if an I/O error occurs.
   23.99 -     */
  23.100 -    void write(byte b[], int off, int len) throws IOException;
  23.101 -
  23.102 -    /**
  23.103 -     * Writes a <code>boolean</code> value to this output stream.
  23.104 -     * If the argument <code>v</code>
  23.105 -     * is <code>true</code>, the value <code>(byte)1</code>
  23.106 -     * is written; if <code>v</code> is <code>false</code>,
  23.107 -     * the  value <code>(byte)0</code> is written.
  23.108 -     * The byte written by this method may
  23.109 -     * be read by the <code>readBoolean</code>
  23.110 -     * method of interface <code>DataInput</code>,
  23.111 -     * which will then return a <code>boolean</code>
  23.112 -     * equal to <code>v</code>.
  23.113 -     *
  23.114 -     * @param      v   the boolean to be written.
  23.115 -     * @throws     IOException  if an I/O error occurs.
  23.116 -     */
  23.117 -    void writeBoolean(boolean v) throws IOException;
  23.118 -
  23.119 -    /**
  23.120 -     * Writes to the output stream the eight low-
  23.121 -     * order bits of the argument <code>v</code>.
  23.122 -     * The 24 high-order bits of <code>v</code>
  23.123 -     * are ignored. (This means  that <code>writeByte</code>
  23.124 -     * does exactly the same thing as <code>write</code>
  23.125 -     * for an integer argument.) The byte written
  23.126 -     * by this method may be read by the <code>readByte</code>
  23.127 -     * method of interface <code>DataInput</code>,
  23.128 -     * which will then return a <code>byte</code>
  23.129 -     * equal to <code>(byte)v</code>.
  23.130 -     *
  23.131 -     * @param      v   the byte value to be written.
  23.132 -     * @throws     IOException  if an I/O error occurs.
  23.133 -     */
  23.134 -    void writeByte(int v) throws IOException;
  23.135 -
  23.136 -    /**
  23.137 -     * Writes two bytes to the output
  23.138 -     * stream to represent the value of the argument.
  23.139 -     * The byte values to be written, in the  order
  23.140 -     * shown, are: <p>
  23.141 -     * <pre><code>
  23.142 -     * (byte)(0xff &amp; (v &gt;&gt; 8))
  23.143 -     * (byte)(0xff &amp; v)
  23.144 -     * </code> </pre> <p>
  23.145 -     * The bytes written by this method may be
  23.146 -     * read by the <code>readShort</code> method
  23.147 -     * of interface <code>DataInput</code> , which
  23.148 -     * will then return a <code>short</code> equal
  23.149 -     * to <code>(short)v</code>.
  23.150 -     *
  23.151 -     * @param      v   the <code>short</code> value to be written.
  23.152 -     * @throws     IOException  if an I/O error occurs.
  23.153 -     */
  23.154 -    void writeShort(int v) throws IOException;
  23.155 -
  23.156 -    /**
  23.157 -     * Writes a <code>char</code> value, which
  23.158 -     * is comprised of two bytes, to the
  23.159 -     * output stream.
  23.160 -     * The byte values to be written, in the  order
  23.161 -     * shown, are:
  23.162 -     * <p><pre><code>
  23.163 -     * (byte)(0xff &amp; (v &gt;&gt; 8))
  23.164 -     * (byte)(0xff &amp; v)
  23.165 -     * </code></pre><p>
  23.166 -     * The bytes written by this method may be
  23.167 -     * read by the <code>readChar</code> method
  23.168 -     * of interface <code>DataInput</code> , which
  23.169 -     * will then return a <code>char</code> equal
  23.170 -     * to <code>(char)v</code>.
  23.171 -     *
  23.172 -     * @param      v   the <code>char</code> value to be written.
  23.173 -     * @throws     IOException  if an I/O error occurs.
  23.174 -     */
  23.175 -    void writeChar(int v) throws IOException;
  23.176 -
  23.177 -    /**
  23.178 -     * Writes an <code>int</code> value, which is
  23.179 -     * comprised of four bytes, to the output stream.
  23.180 -     * The byte values to be written, in the  order
  23.181 -     * shown, are:
  23.182 -     * <p><pre><code>
  23.183 -     * (byte)(0xff &amp; (v &gt;&gt; 24))
  23.184 -     * (byte)(0xff &amp; (v &gt;&gt; 16))
  23.185 -     * (byte)(0xff &amp; (v &gt;&gt; &#32; &#32;8))
  23.186 -     * (byte)(0xff &amp; v)
  23.187 -     * </code></pre><p>
  23.188 -     * The bytes written by this method may be read
  23.189 -     * by the <code>readInt</code> method of interface
  23.190 -     * <code>DataInput</code> , which will then
  23.191 -     * return an <code>int</code> equal to <code>v</code>.
  23.192 -     *
  23.193 -     * @param      v   the <code>int</code> value to be written.
  23.194 -     * @throws     IOException  if an I/O error occurs.
  23.195 -     */
  23.196 -    void writeInt(int v) throws IOException;
  23.197 -
  23.198 -    /**
  23.199 -     * Writes a <code>long</code> value, which is
  23.200 -     * comprised of eight bytes, to the output stream.
  23.201 -     * The byte values to be written, in the  order
  23.202 -     * shown, are:
  23.203 -     * <p><pre><code>
  23.204 -     * (byte)(0xff &amp; (v &gt;&gt; 56))
  23.205 -     * (byte)(0xff &amp; (v &gt;&gt; 48))
  23.206 -     * (byte)(0xff &amp; (v &gt;&gt; 40))
  23.207 -     * (byte)(0xff &amp; (v &gt;&gt; 32))
  23.208 -     * (byte)(0xff &amp; (v &gt;&gt; 24))
  23.209 -     * (byte)(0xff &amp; (v &gt;&gt; 16))
  23.210 -     * (byte)(0xff &amp; (v &gt;&gt;  8))
  23.211 -     * (byte)(0xff &amp; v)
  23.212 -     * </code></pre><p>
  23.213 -     * The bytes written by this method may be
  23.214 -     * read by the <code>readLong</code> method
  23.215 -     * of interface <code>DataInput</code> , which
  23.216 -     * will then return a <code>long</code> equal
  23.217 -     * to <code>v</code>.
  23.218 -     *
  23.219 -     * @param      v   the <code>long</code> value to be written.
  23.220 -     * @throws     IOException  if an I/O error occurs.
  23.221 -     */
  23.222 -    void writeLong(long v) throws IOException;
  23.223 -
  23.224 -    /**
  23.225 -     * Writes a <code>float</code> value,
  23.226 -     * which is comprised of four bytes, to the output stream.
  23.227 -     * It does this as if it first converts this
  23.228 -     * <code>float</code> value to an <code>int</code>
  23.229 -     * in exactly the manner of the <code>Float.floatToIntBits</code>
  23.230 -     * method  and then writes the <code>int</code>
  23.231 -     * value in exactly the manner of the  <code>writeInt</code>
  23.232 -     * method.  The bytes written by this method
  23.233 -     * may be read by the <code>readFloat</code>
  23.234 -     * method of interface <code>DataInput</code>,
  23.235 -     * which will then return a <code>float</code>
  23.236 -     * equal to <code>v</code>.
  23.237 -     *
  23.238 -     * @param      v   the <code>float</code> value to be written.
  23.239 -     * @throws     IOException  if an I/O error occurs.
  23.240 -     */
  23.241 -    void writeFloat(float v) throws IOException;
  23.242 -
  23.243 -    /**
  23.244 -     * Writes a <code>double</code> value,
  23.245 -     * which is comprised of eight bytes, to the output stream.
  23.246 -     * It does this as if it first converts this
  23.247 -     * <code>double</code> value to a <code>long</code>
  23.248 -     * in exactly the manner of the <code>Double.doubleToLongBits</code>
  23.249 -     * method  and then writes the <code>long</code>
  23.250 -     * value in exactly the manner of the  <code>writeLong</code>
  23.251 -     * method. The bytes written by this method
  23.252 -     * may be read by the <code>readDouble</code>
  23.253 -     * method of interface <code>DataInput</code>,
  23.254 -     * which will then return a <code>double</code>
  23.255 -     * equal to <code>v</code>.
  23.256 -     *
  23.257 -     * @param      v   the <code>double</code> value to be written.
  23.258 -     * @throws     IOException  if an I/O error occurs.
  23.259 -     */
  23.260 -    void writeDouble(double v) throws IOException;
  23.261 -
  23.262 -    /**
  23.263 -     * Writes a string to the output stream.
  23.264 -     * For every character in the string
  23.265 -     * <code>s</code>,  taken in order, one byte
  23.266 -     * is written to the output stream.  If
  23.267 -     * <code>s</code> is <code>null</code>, a <code>NullPointerException</code>
  23.268 -     * is thrown.<p>  If <code>s.length</code>
  23.269 -     * is zero, then no bytes are written. Otherwise,
  23.270 -     * the character <code>s[0]</code> is written
  23.271 -     * first, then <code>s[1]</code>, and so on;
  23.272 -     * the last character written is <code>s[s.length-1]</code>.
  23.273 -     * For each character, one byte is written,
  23.274 -     * the low-order byte, in exactly the manner
  23.275 -     * of the <code>writeByte</code> method . The
  23.276 -     * high-order eight bits of each character
  23.277 -     * in the string are ignored.
  23.278 -     *
  23.279 -     * @param      s   the string of bytes to be written.
  23.280 -     * @throws     IOException  if an I/O error occurs.
  23.281 -     */
  23.282 -    void writeBytes(String s) throws IOException;
  23.283 -
  23.284 -    /**
  23.285 -     * Writes every character in the string <code>s</code>,
  23.286 -     * to the output stream, in order,
  23.287 -     * two bytes per character. If <code>s</code>
  23.288 -     * is <code>null</code>, a <code>NullPointerException</code>
  23.289 -     * is thrown.  If <code>s.length</code>
  23.290 -     * is zero, then no characters are written.
  23.291 -     * Otherwise, the character <code>s[0]</code>
  23.292 -     * is written first, then <code>s[1]</code>,
  23.293 -     * and so on; the last character written is
  23.294 -     * <code>s[s.length-1]</code>. For each character,
  23.295 -     * two bytes are actually written, high-order
  23.296 -     * byte first, in exactly the manner of the
  23.297 -     * <code>writeChar</code> method.
  23.298 -     *
  23.299 -     * @param      s   the string value to be written.
  23.300 -     * @throws     IOException  if an I/O error occurs.
  23.301 -     */
  23.302 -    void writeChars(String s) throws IOException;
  23.303 -
  23.304 -    /**
  23.305 -     * Writes two bytes of length information
  23.306 -     * to the output stream, followed
  23.307 -     * by the
  23.308 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  23.309 -     * representation
  23.310 -     * of  every character in the string <code>s</code>.
  23.311 -     * If <code>s</code> is <code>null</code>,
  23.312 -     * a <code>NullPointerException</code> is thrown.
  23.313 -     * Each character in the string <code>s</code>
  23.314 -     * is converted to a group of one, two, or
  23.315 -     * three bytes, depending on the value of the
  23.316 -     * character.<p>
  23.317 -     * If a character <code>c</code>
  23.318 -     * is in the range <code>&#92;u0001</code> through
  23.319 -     * <code>&#92;u007f</code>, it is represented
  23.320 -     * by one byte:<p>
  23.321 -     * <pre>(byte)c </pre>  <p>
  23.322 -     * If a character <code>c</code> is <code>&#92;u0000</code>
  23.323 -     * or is in the range <code>&#92;u0080</code>
  23.324 -     * through <code>&#92;u07ff</code>, then it is
  23.325 -     * represented by two bytes, to be written
  23.326 -     * in the order shown:<p> <pre><code>
  23.327 -     * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
  23.328 -     * (byte)(0x80 | (0x3f &amp; c))
  23.329 -     *  </code></pre>  <p> If a character
  23.330 -     * <code>c</code> is in the range <code>&#92;u0800</code>
  23.331 -     * through <code>uffff</code>, then it is
  23.332 -     * represented by three bytes, to be written
  23.333 -     * in the order shown:<p> <pre><code>
  23.334 -     * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
  23.335 -     * (byte)(0x80 | (0x3f &amp; (c &gt;&gt;  6)))
  23.336 -     * (byte)(0x80 | (0x3f &amp; c))
  23.337 -     *  </code></pre>  <p> First,
  23.338 -     * the total number of bytes needed to represent
  23.339 -     * all the characters of <code>s</code> is
  23.340 -     * calculated. If this number is larger than
  23.341 -     * <code>65535</code>, then a <code>UTFDataFormatException</code>
  23.342 -     * is thrown. Otherwise, this length is written
  23.343 -     * to the output stream in exactly the manner
  23.344 -     * of the <code>writeShort</code> method;
  23.345 -     * after this, the one-, two-, or three-byte
  23.346 -     * representation of each character in the
  23.347 -     * string <code>s</code> is written.<p>  The
  23.348 -     * bytes written by this method may be read
  23.349 -     * by the <code>readUTF</code> method of interface
  23.350 -     * <code>DataInput</code> , which will then
  23.351 -     * return a <code>String</code> equal to <code>s</code>.
  23.352 -     *
  23.353 -     * @param      s   the string value to be written.
  23.354 -     * @throws     IOException  if an I/O error occurs.
  23.355 -     */
  23.356 -    void writeUTF(String s) throws IOException;
  23.357 -}
    24.1 --- a/emul/compact/src/main/java/java/io/DataOutputStream.java	Mon Feb 25 19:00:08 2013 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,416 +0,0 @@
    24.4 -/*
    24.5 - * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
    24.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 - *
    24.8 - * This code is free software; you can redistribute it and/or modify it
    24.9 - * under the terms of the GNU General Public License version 2 only, as
   24.10 - * published by the Free Software Foundation.  Oracle designates this
   24.11 - * particular file as subject to the "Classpath" exception as provided
   24.12 - * by Oracle in the LICENSE file that accompanied this code.
   24.13 - *
   24.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   24.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.17 - * version 2 for more details (a copy is included in the LICENSE file that
   24.18 - * accompanied this code).
   24.19 - *
   24.20 - * You should have received a copy of the GNU General Public License version
   24.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   24.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.23 - *
   24.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.25 - * or visit www.oracle.com if you need additional information or have any
   24.26 - * questions.
   24.27 - */
   24.28 -
   24.29 -package java.io;
   24.30 -
   24.31 -/**
   24.32 - * A data output stream lets an application write primitive Java data
   24.33 - * types to an output stream in a portable way. An application can
   24.34 - * then use a data input stream to read the data back in.
   24.35 - *
   24.36 - * @author  unascribed
   24.37 - * @see     java.io.DataInputStream
   24.38 - * @since   JDK1.0
   24.39 - */
   24.40 -public
   24.41 -class DataOutputStream extends FilterOutputStream implements DataOutput {
   24.42 -    /**
   24.43 -     * The number of bytes written to the data output stream so far.
   24.44 -     * If this counter overflows, it will be wrapped to Integer.MAX_VALUE.
   24.45 -     */
   24.46 -    protected int written;
   24.47 -
   24.48 -    /**
   24.49 -     * bytearr is initialized on demand by writeUTF
   24.50 -     */
   24.51 -    private byte[] bytearr = null;
   24.52 -
   24.53 -    /**
   24.54 -     * Creates a new data output stream to write data to the specified
   24.55 -     * underlying output stream. The counter <code>written</code> is
   24.56 -     * set to zero.
   24.57 -     *
   24.58 -     * @param   out   the underlying output stream, to be saved for later
   24.59 -     *                use.
   24.60 -     * @see     java.io.FilterOutputStream#out
   24.61 -     */
   24.62 -    public DataOutputStream(OutputStream out) {
   24.63 -        super(out);
   24.64 -    }
   24.65 -
   24.66 -    /**
   24.67 -     * Increases the written counter by the specified value
   24.68 -     * until it reaches Integer.MAX_VALUE.
   24.69 -     */
   24.70 -    private void incCount(int value) {
   24.71 -        int temp = written + value;
   24.72 -        if (temp < 0) {
   24.73 -            temp = Integer.MAX_VALUE;
   24.74 -        }
   24.75 -        written = temp;
   24.76 -    }
   24.77 -
   24.78 -    /**
   24.79 -     * Writes the specified byte (the low eight bits of the argument
   24.80 -     * <code>b</code>) to the underlying output stream. If no exception
   24.81 -     * is thrown, the counter <code>written</code> is incremented by
   24.82 -     * <code>1</code>.
   24.83 -     * <p>
   24.84 -     * Implements the <code>write</code> method of <code>OutputStream</code>.
   24.85 -     *
   24.86 -     * @param      b   the <code>byte</code> to be written.
   24.87 -     * @exception  IOException  if an I/O error occurs.
   24.88 -     * @see        java.io.FilterOutputStream#out
   24.89 -     */
   24.90 -    public synchronized void write(int b) throws IOException {
   24.91 -        out.write(b);
   24.92 -        incCount(1);
   24.93 -    }
   24.94 -
   24.95 -    /**
   24.96 -     * Writes <code>len</code> bytes from the specified byte array
   24.97 -     * starting at offset <code>off</code> to the underlying output stream.
   24.98 -     * If no exception is thrown, the counter <code>written</code> is
   24.99 -     * incremented by <code>len</code>.
  24.100 -     *
  24.101 -     * @param      b     the data.
  24.102 -     * @param      off   the start offset in the data.
  24.103 -     * @param      len   the number of bytes to write.
  24.104 -     * @exception  IOException  if an I/O error occurs.
  24.105 -     * @see        java.io.FilterOutputStream#out
  24.106 -     */
  24.107 -    public synchronized void write(byte b[], int off, int len)
  24.108 -        throws IOException
  24.109 -    {
  24.110 -        out.write(b, off, len);
  24.111 -        incCount(len);
  24.112 -    }
  24.113 -
  24.114 -    /**
  24.115 -     * Flushes this data output stream. This forces any buffered output
  24.116 -     * bytes to be written out to the stream.
  24.117 -     * <p>
  24.118 -     * The <code>flush</code> method of <code>DataOutputStream</code>
  24.119 -     * calls the <code>flush</code> method of its underlying output stream.
  24.120 -     *
  24.121 -     * @exception  IOException  if an I/O error occurs.
  24.122 -     * @see        java.io.FilterOutputStream#out
  24.123 -     * @see        java.io.OutputStream#flush()
  24.124 -     */
  24.125 -    public void flush() throws IOException {
  24.126 -        out.flush();
  24.127 -    }
  24.128 -
  24.129 -    /**
  24.130 -     * Writes a <code>boolean</code> to the underlying output stream as
  24.131 -     * a 1-byte value. The value <code>true</code> is written out as the
  24.132 -     * value <code>(byte)1</code>; the value <code>false</code> is
  24.133 -     * written out as the value <code>(byte)0</code>. If no exception is
  24.134 -     * thrown, the counter <code>written</code> is incremented by
  24.135 -     * <code>1</code>.
  24.136 -     *
  24.137 -     * @param      v   a <code>boolean</code> value to be written.
  24.138 -     * @exception  IOException  if an I/O error occurs.
  24.139 -     * @see        java.io.FilterOutputStream#out
  24.140 -     */
  24.141 -    public final void writeBoolean(boolean v) throws IOException {
  24.142 -        out.write(v ? 1 : 0);
  24.143 -        incCount(1);
  24.144 -    }
  24.145 -
  24.146 -    /**
  24.147 -     * Writes out a <code>byte</code> to the underlying output stream as
  24.148 -     * a 1-byte value. If no exception is thrown, the counter
  24.149 -     * <code>written</code> is incremented by <code>1</code>.
  24.150 -     *
  24.151 -     * @param      v   a <code>byte</code> value to be written.
  24.152 -     * @exception  IOException  if an I/O error occurs.
  24.153 -     * @see        java.io.FilterOutputStream#out
  24.154 -     */
  24.155 -    public final void writeByte(int v) throws IOException {
  24.156 -        out.write(v);
  24.157 -        incCount(1);
  24.158 -    }
  24.159 -
  24.160 -    /**
  24.161 -     * Writes a <code>short</code> to the underlying output stream as two
  24.162 -     * bytes, high byte first. If no exception is thrown, the counter
  24.163 -     * <code>written</code> is incremented by <code>2</code>.
  24.164 -     *
  24.165 -     * @param      v   a <code>short</code> to be written.
  24.166 -     * @exception  IOException  if an I/O error occurs.
  24.167 -     * @see        java.io.FilterOutputStream#out
  24.168 -     */
  24.169 -    public final void writeShort(int v) throws IOException {
  24.170 -        out.write((v >>> 8) & 0xFF);
  24.171 -        out.write((v >>> 0) & 0xFF);
  24.172 -        incCount(2);
  24.173 -    }
  24.174 -
  24.175 -    /**
  24.176 -     * Writes a <code>char</code> to the underlying output stream as a
  24.177 -     * 2-byte value, high byte first. If no exception is thrown, the
  24.178 -     * counter <code>written</code> is incremented by <code>2</code>.
  24.179 -     *
  24.180 -     * @param      v   a <code>char</code> value to be written.
  24.181 -     * @exception  IOException  if an I/O error occurs.
  24.182 -     * @see        java.io.FilterOutputStream#out
  24.183 -     */
  24.184 -    public final void writeChar(int v) throws IOException {
  24.185 -        out.write((v >>> 8) & 0xFF);
  24.186 -        out.write((v >>> 0) & 0xFF);
  24.187 -        incCount(2);
  24.188 -    }
  24.189 -
  24.190 -    /**
  24.191 -     * Writes an <code>int</code> to the underlying output stream as four
  24.192 -     * bytes, high byte first. If no exception is thrown, the counter
  24.193 -     * <code>written</code> is incremented by <code>4</code>.
  24.194 -     *
  24.195 -     * @param      v   an <code>int</code> to be written.
  24.196 -     * @exception  IOException  if an I/O error occurs.
  24.197 -     * @see        java.io.FilterOutputStream#out
  24.198 -     */
  24.199 -    public final void writeInt(int v) throws IOException {
  24.200 -        out.write((v >>> 24) & 0xFF);
  24.201 -        out.write((v >>> 16) & 0xFF);
  24.202 -        out.write((v >>>  8) & 0xFF);
  24.203 -        out.write((v >>>  0) & 0xFF);
  24.204 -        incCount(4);
  24.205 -    }
  24.206 -
  24.207 -    private byte writeBuffer[] = new byte[8];
  24.208 -
  24.209 -    /**
  24.210 -     * Writes a <code>long</code> to the underlying output stream as eight
  24.211 -     * bytes, high byte first. In no exception is thrown, the counter
  24.212 -     * <code>written</code> is incremented by <code>8</code>.
  24.213 -     *
  24.214 -     * @param      v   a <code>long</code> to be written.
  24.215 -     * @exception  IOException  if an I/O error occurs.
  24.216 -     * @see        java.io.FilterOutputStream#out
  24.217 -     */
  24.218 -    public final void writeLong(long v) throws IOException {
  24.219 -        writeBuffer[0] = (byte)(v >>> 56);
  24.220 -        writeBuffer[1] = (byte)(v >>> 48);
  24.221 -        writeBuffer[2] = (byte)(v >>> 40);
  24.222 -        writeBuffer[3] = (byte)(v >>> 32);
  24.223 -        writeBuffer[4] = (byte)(v >>> 24);
  24.224 -        writeBuffer[5] = (byte)(v >>> 16);
  24.225 -        writeBuffer[6] = (byte)(v >>>  8);
  24.226 -        writeBuffer[7] = (byte)(v >>>  0);
  24.227 -        out.write(writeBuffer, 0, 8);
  24.228 -        incCount(8);
  24.229 -    }
  24.230 -
  24.231 -    /**
  24.232 -     * Converts the float argument to an <code>int</code> using the
  24.233 -     * <code>floatToIntBits</code> method in class <code>Float</code>,
  24.234 -     * and then writes that <code>int</code> value to the underlying
  24.235 -     * output stream as a 4-byte quantity, high byte first. If no
  24.236 -     * exception is thrown, the counter <code>written</code> is
  24.237 -     * incremented by <code>4</code>.
  24.238 -     *
  24.239 -     * @param      v   a <code>float</code> value to be written.
  24.240 -     * @exception  IOException  if an I/O error occurs.
  24.241 -     * @see        java.io.FilterOutputStream#out
  24.242 -     * @see        java.lang.Float#floatToIntBits(float)
  24.243 -     */
  24.244 -    public final void writeFloat(float v) throws IOException {
  24.245 -        writeInt(Float.floatToIntBits(v));
  24.246 -    }
  24.247 -
  24.248 -    /**
  24.249 -     * Converts the double argument to a <code>long</code> using the
  24.250 -     * <code>doubleToLongBits</code> method in class <code>Double</code>,
  24.251 -     * and then writes that <code>long</code> value to the underlying
  24.252 -     * output stream as an 8-byte quantity, high byte first. If no
  24.253 -     * exception is thrown, the counter <code>written</code> is
  24.254 -     * incremented by <code>8</code>.
  24.255 -     *
  24.256 -     * @param      v   a <code>double</code> value to be written.
  24.257 -     * @exception  IOException  if an I/O error occurs.
  24.258 -     * @see        java.io.FilterOutputStream#out
  24.259 -     * @see        java.lang.Double#doubleToLongBits(double)
  24.260 -     */
  24.261 -    public final void writeDouble(double v) throws IOException {
  24.262 -        writeLong(Double.doubleToLongBits(v));
  24.263 -    }
  24.264 -
  24.265 -    /**
  24.266 -     * Writes out the string to the underlying output stream as a
  24.267 -     * sequence of bytes. Each character in the string is written out, in
  24.268 -     * sequence, by discarding its high eight bits. If no exception is
  24.269 -     * thrown, the counter <code>written</code> is incremented by the
  24.270 -     * length of <code>s</code>.
  24.271 -     *
  24.272 -     * @param      s   a string of bytes to be written.
  24.273 -     * @exception  IOException  if an I/O error occurs.
  24.274 -     * @see        java.io.FilterOutputStream#out
  24.275 -     */
  24.276 -    public final void writeBytes(String s) throws IOException {
  24.277 -        int len = s.length();
  24.278 -        for (int i = 0 ; i < len ; i++) {
  24.279 -            out.write((byte)s.charAt(i));
  24.280 -        }
  24.281 -        incCount(len);
  24.282 -    }
  24.283 -
  24.284 -    /**
  24.285 -     * Writes a string to the underlying output stream as a sequence of
  24.286 -     * characters. Each character is written to the data output stream as
  24.287 -     * if by the <code>writeChar</code> method. If no exception is
  24.288 -     * thrown, the counter <code>written</code> is incremented by twice
  24.289 -     * the length of <code>s</code>.
  24.290 -     *
  24.291 -     * @param      s   a <code>String</code> value to be written.
  24.292 -     * @exception  IOException  if an I/O error occurs.
  24.293 -     * @see        java.io.DataOutputStream#writeChar(int)
  24.294 -     * @see        java.io.FilterOutputStream#out
  24.295 -     */
  24.296 -    public final void writeChars(String s) throws IOException {
  24.297 -        int len = s.length();
  24.298 -        for (int i = 0 ; i < len ; i++) {
  24.299 -            int v = s.charAt(i);
  24.300 -            out.write((v >>> 8) & 0xFF);
  24.301 -            out.write((v >>> 0) & 0xFF);
  24.302 -        }
  24.303 -        incCount(len * 2);
  24.304 -    }
  24.305 -
  24.306 -    /**
  24.307 -     * Writes a string to the underlying output stream using
  24.308 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  24.309 -     * encoding in a machine-independent manner.
  24.310 -     * <p>
  24.311 -     * First, two bytes are written to the output stream as if by the
  24.312 -     * <code>writeShort</code> method giving the number of bytes to
  24.313 -     * follow. This value is the number of bytes actually written out,
  24.314 -     * not the length of the string. Following the length, each character
  24.315 -     * of the string is output, in sequence, using the modified UTF-8 encoding
  24.316 -     * for the character. If no exception is thrown, the counter
  24.317 -     * <code>written</code> is incremented by the total number of
  24.318 -     * bytes written to the output stream. This will be at least two
  24.319 -     * plus the length of <code>str</code>, and at most two plus
  24.320 -     * thrice the length of <code>str</code>.
  24.321 -     *
  24.322 -     * @param      str   a string to be written.
  24.323 -     * @exception  IOException  if an I/O error occurs.
  24.324 -     */
  24.325 -    public final void writeUTF(String str) throws IOException {
  24.326 -        writeUTF(str, this);
  24.327 -    }
  24.328 -
  24.329 -    /**
  24.330 -     * Writes a string to the specified DataOutput using
  24.331 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  24.332 -     * encoding in a machine-independent manner.
  24.333 -     * <p>
  24.334 -     * First, two bytes are written to out as if by the <code>writeShort</code>
  24.335 -     * method giving the number of bytes to follow. This value is the number of
  24.336 -     * bytes actually written out, not the length of the string. Following the
  24.337 -     * length, each character of the string is output, in sequence, using the
  24.338 -     * modified UTF-8 encoding for the character. If no exception is thrown, the
  24.339 -     * counter <code>written</code> is incremented by the total number of
  24.340 -     * bytes written to the output stream. This will be at least two
  24.341 -     * plus the length of <code>str</code>, and at most two plus
  24.342 -     * thrice the length of <code>str</code>.
  24.343 -     *
  24.344 -     * @param      str   a string to be written.
  24.345 -     * @param      out   destination to write to
  24.346 -     * @return     The number of bytes written out.
  24.347 -     * @exception  IOException  if an I/O error occurs.
  24.348 -     */
  24.349 -    static int writeUTF(String str, DataOutput out) throws IOException {
  24.350 -        int strlen = str.length();
  24.351 -        int utflen = 0;
  24.352 -        int c, count = 0;
  24.353 -
  24.354 -        /* use charAt instead of copying String to char array */
  24.355 -        for (int i = 0; i < strlen; i++) {
  24.356 -            c = str.charAt(i);
  24.357 -            if ((c >= 0x0001) && (c <= 0x007F)) {
  24.358 -                utflen++;
  24.359 -            } else if (c > 0x07FF) {
  24.360 -                utflen += 3;
  24.361 -            } else {
  24.362 -                utflen += 2;
  24.363 -            }
  24.364 -        }
  24.365 -
  24.366 -        if (utflen > 65535)
  24.367 -            throw new UTFDataFormatException(
  24.368 -                "encoded string too long: " + utflen + " bytes");
  24.369 -
  24.370 -        byte[] bytearr = null;
  24.371 -        if (out instanceof DataOutputStream) {
  24.372 -            DataOutputStream dos = (DataOutputStream)out;
  24.373 -            if(dos.bytearr == null || (dos.bytearr.length < (utflen+2)))
  24.374 -                dos.bytearr = new byte[(utflen*2) + 2];
  24.375 -            bytearr = dos.bytearr;
  24.376 -        } else {
  24.377 -            bytearr = new byte[utflen+2];
  24.378 -        }
  24.379 -
  24.380 -        bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF);
  24.381 -        bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF);
  24.382 -
  24.383 -        int i=0;
  24.384 -        for (i=0; i<strlen; i++) {
  24.385 -           c = str.charAt(i);
  24.386 -           if (!((c >= 0x0001) && (c <= 0x007F))) break;
  24.387 -           bytearr[count++] = (byte) c;
  24.388 -        }
  24.389 -
  24.390 -        for (;i < strlen; i++){
  24.391 -            c = str.charAt(i);
  24.392 -            if ((c >= 0x0001) && (c <= 0x007F)) {
  24.393 -                bytearr[count++] = (byte) c;
  24.394 -
  24.395 -            } else if (c > 0x07FF) {
  24.396 -                bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
  24.397 -                bytearr[count++] = (byte) (0x80 | ((c >>  6) & 0x3F));
  24.398 -                bytearr[count++] = (byte) (0x80 | ((c >>  0) & 0x3F));
  24.399 -            } else {
  24.400 -                bytearr[count++] = (byte) (0xC0 | ((c >>  6) & 0x1F));
  24.401 -                bytearr[count++] = (byte) (0x80 | ((c >>  0) & 0x3F));
  24.402 -            }
  24.403 -        }
  24.404 -        out.write(bytearr, 0, utflen+2);
  24.405 -        return utflen + 2;
  24.406 -    }
  24.407 -
  24.408 -    /**
  24.409 -     * Returns the current value of the counter <code>written</code>,
  24.410 -     * the number of bytes written to this data output stream so far.
  24.411 -     * If the counter overflows, it will be wrapped to Integer.MAX_VALUE.
  24.412 -     *
  24.413 -     * @return  the value of the <code>written</code> field.
  24.414 -     * @see     java.io.DataOutputStream#written
  24.415 -     */
  24.416 -    public final int size() {
  24.417 -        return written;
  24.418 -    }
  24.419 -}
    25.1 --- a/emul/compact/src/main/java/java/io/Externalizable.java	Mon Feb 25 19:00:08 2013 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,97 +0,0 @@
    25.4 -/*
    25.5 - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
    25.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.7 - *
    25.8 - * This code is free software; you can redistribute it and/or modify it
    25.9 - * under the terms of the GNU General Public License version 2 only, as
   25.10 - * published by the Free Software Foundation.  Oracle designates this
   25.11 - * particular file as subject to the "Classpath" exception as provided
   25.12 - * by Oracle in the LICENSE file that accompanied this code.
   25.13 - *
   25.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   25.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.17 - * version 2 for more details (a copy is included in the LICENSE file that
   25.18 - * accompanied this code).
   25.19 - *
   25.20 - * You should have received a copy of the GNU General Public License version
   25.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   25.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.23 - *
   25.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.25 - * or visit www.oracle.com if you need additional information or have any
   25.26 - * questions.
   25.27 - */
   25.28 -
   25.29 -package java.io;
   25.30 -
   25.31 -import java.io.ObjectOutput;
   25.32 -import java.io.ObjectInput;
   25.33 -
   25.34 -/**
   25.35 - * Only the identity of the class of an Externalizable instance is
   25.36 - * written in the serialization stream and it is the responsibility
   25.37 - * of the class to save and restore the contents of its instances.
   25.38 - *
   25.39 - * The writeExternal and readExternal methods of the Externalizable
   25.40 - * interface are implemented by a class to give the class complete
   25.41 - * control over the format and contents of the stream for an object
   25.42 - * and its supertypes. These methods must explicitly
   25.43 - * coordinate with the supertype to save its state. These methods supersede
   25.44 - * customized implementations of writeObject and readObject methods.<br>
   25.45 - *
   25.46 - * Object Serialization uses the Serializable and Externalizable
   25.47 - * interfaces.  Object persistence mechanisms can use them as well.  Each
   25.48 - * object to be stored is tested for the Externalizable interface. If
   25.49 - * the object supports Externalizable, the writeExternal method is called. If the
   25.50 - * object does not support Externalizable and does implement
   25.51 - * Serializable, the object is saved using
   25.52 - * ObjectOutputStream. <br> When an Externalizable object is
   25.53 - * reconstructed, an instance is created using the public no-arg
   25.54 - * constructor, then the readExternal method called.  Serializable
   25.55 - * objects are restored by reading them from an ObjectInputStream.<br>
   25.56 - *
   25.57 - * An Externalizable instance can designate a substitution object via
   25.58 - * the writeReplace and readResolve methods documented in the Serializable
   25.59 - * interface.<br>
   25.60 - *
   25.61 - * @author  unascribed
   25.62 - * @see java.io.ObjectOutputStream
   25.63 - * @see java.io.ObjectInputStream
   25.64 - * @see java.io.ObjectOutput
   25.65 - * @see java.io.ObjectInput
   25.66 - * @see java.io.Serializable
   25.67 - * @since   JDK1.1
   25.68 - */
   25.69 -public interface Externalizable extends java.io.Serializable {
   25.70 -    /**
   25.71 -     * The object implements the writeExternal method to save its contents
   25.72 -     * by calling the methods of DataOutput for its primitive values or
   25.73 -     * calling the writeObject method of ObjectOutput for objects, strings,
   25.74 -     * and arrays.
   25.75 -     *
   25.76 -     * @serialData Overriding methods should use this tag to describe
   25.77 -     *             the data layout of this Externalizable object.
   25.78 -     *             List the sequence of element types and, if possible,
   25.79 -     *             relate the element to a public/protected field and/or
   25.80 -     *             method of this Externalizable class.
   25.81 -     *
   25.82 -     * @param out the stream to write the object to
   25.83 -     * @exception IOException Includes any I/O exceptions that may occur
   25.84 -     */
   25.85 -    void writeExternal(ObjectOutput out) throws IOException;
   25.86 -
   25.87 -    /**
   25.88 -     * The object implements the readExternal method to restore its
   25.89 -     * contents by calling the methods of DataInput for primitive
   25.90 -     * types and readObject for objects, strings and arrays.  The
   25.91 -     * readExternal method must read the values in the same sequence
   25.92 -     * and with the same types as were written by writeExternal.
   25.93 -     *
   25.94 -     * @param in the stream to read data from in order to restore the object
   25.95 -     * @exception IOException if I/O errors occur
   25.96 -     * @exception ClassNotFoundException If the class for an object being
   25.97 -     *              restored cannot be found.
   25.98 -     */
   25.99 -    void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
  25.100 -}
    26.1 --- a/emul/compact/src/main/java/java/io/FilterOutputStream.java	Mon Feb 25 19:00:08 2013 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,162 +0,0 @@
    26.4 -/*
    26.5 - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
    26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 - *
    26.8 - * This code is free software; you can redistribute it and/or modify it
    26.9 - * under the terms of the GNU General Public License version 2 only, as
   26.10 - * published by the Free Software Foundation.  Oracle designates this
   26.11 - * particular file as subject to the "Classpath" exception as provided
   26.12 - * by Oracle in the LICENSE file that accompanied this code.
   26.13 - *
   26.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   26.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.17 - * version 2 for more details (a copy is included in the LICENSE file that
   26.18 - * accompanied this code).
   26.19 - *
   26.20 - * You should have received a copy of the GNU General Public License version
   26.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   26.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.23 - *
   26.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.25 - * or visit www.oracle.com if you need additional information or have any
   26.26 - * questions.
   26.27 - */
   26.28 -
   26.29 -package java.io;
   26.30 -
   26.31 -/**
   26.32 - * This class is the superclass of all classes that filter output
   26.33 - * streams. These streams sit on top of an already existing output
   26.34 - * stream (the <i>underlying</i> output stream) which it uses as its
   26.35 - * basic sink of data, but possibly transforming the data along the
   26.36 - * way or providing additional functionality.
   26.37 - * <p>
   26.38 - * The class <code>FilterOutputStream</code> itself simply overrides
   26.39 - * all methods of <code>OutputStream</code> with versions that pass
   26.40 - * all requests to the underlying output stream. Subclasses of
   26.41 - * <code>FilterOutputStream</code> may further override some of these
   26.42 - * methods as well as provide additional methods and fields.
   26.43 - *
   26.44 - * @author  Jonathan Payne
   26.45 - * @since   JDK1.0
   26.46 - */
   26.47 -public
   26.48 -class FilterOutputStream extends OutputStream {
   26.49 -    /**
   26.50 -     * The underlying output stream to be filtered.
   26.51 -     */
   26.52 -    protected OutputStream out;
   26.53 -
   26.54 -    /**
   26.55 -     * Creates an output stream filter built on top of the specified
   26.56 -     * underlying output stream.
   26.57 -     *
   26.58 -     * @param   out   the underlying output stream to be assigned to
   26.59 -     *                the field <tt>this.out</tt> for later use, or
   26.60 -     *                <code>null</code> if this instance is to be
   26.61 -     *                created without an underlying stream.
   26.62 -     */
   26.63 -    public FilterOutputStream(OutputStream out) {
   26.64 -        this.out = out;
   26.65 -    }
   26.66 -
   26.67 -    /**
   26.68 -     * Writes the specified <code>byte</code> to this output stream.
   26.69 -     * <p>
   26.70 -     * The <code>write</code> method of <code>FilterOutputStream</code>
   26.71 -     * calls the <code>write</code> method of its underlying output stream,
   26.72 -     * that is, it performs <tt>out.write(b)</tt>.
   26.73 -     * <p>
   26.74 -     * Implements the abstract <tt>write</tt> method of <tt>OutputStream</tt>.
   26.75 -     *
   26.76 -     * @param      b   the <code>byte</code>.
   26.77 -     * @exception  IOException  if an I/O error occurs.
   26.78 -     */
   26.79 -    public void write(int b) throws IOException {
   26.80 -        out.write(b);
   26.81 -    }
   26.82 -
   26.83 -    /**
   26.84 -     * Writes <code>b.length</code> bytes to this output stream.
   26.85 -     * <p>
   26.86 -     * The <code>write</code> method of <code>FilterOutputStream</code>
   26.87 -     * calls its <code>write</code> method of three arguments with the
   26.88 -     * arguments <code>b</code>, <code>0</code>, and
   26.89 -     * <code>b.length</code>.
   26.90 -     * <p>
   26.91 -     * Note that this method does not call the one-argument
   26.92 -     * <code>write</code> method of its underlying stream with the single
   26.93 -     * argument <code>b</code>.
   26.94 -     *
   26.95 -     * @param      b   the data to be written.
   26.96 -     * @exception  IOException  if an I/O error occurs.
   26.97 -     * @see        java.io.FilterOutputStream#write(byte[], int, int)
   26.98 -     */
   26.99 -    public void write(byte b[]) throws IOException {
  26.100 -        write(b, 0, b.length);
  26.101 -    }
  26.102 -
  26.103 -    /**
  26.104 -     * Writes <code>len</code> bytes from the specified
  26.105 -     * <code>byte</code> array starting at offset <code>off</code> to
  26.106 -     * this output stream.
  26.107 -     * <p>
  26.108 -     * The <code>write</code> method of <code>FilterOutputStream</code>
  26.109 -     * calls the <code>write</code> method of one argument on each
  26.110 -     * <code>byte</code> to output.
  26.111 -     * <p>
  26.112 -     * Note that this method does not call the <code>write</code> method
  26.113 -     * of its underlying input stream with the same arguments. Subclasses
  26.114 -     * of <code>FilterOutputStream</code> should provide a more efficient
  26.115 -     * implementation of this method.
  26.116 -     *
  26.117 -     * @param      b     the data.
  26.118 -     * @param      off   the start offset in the data.
  26.119 -     * @param      len   the number of bytes to write.
  26.120 -     * @exception  IOException  if an I/O error occurs.
  26.121 -     * @see        java.io.FilterOutputStream#write(int)
  26.122 -     */
  26.123 -    public void write(byte b[], int off, int len) throws IOException {
  26.124 -        if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
  26.125 -            throw new IndexOutOfBoundsException();
  26.126 -
  26.127 -        for (int i = 0 ; i < len ; i++) {
  26.128 -            write(b[off + i]);
  26.129 -        }
  26.130 -    }
  26.131 -
  26.132 -    /**
  26.133 -     * Flushes this output stream and forces any buffered output bytes
  26.134 -     * to be written out to the stream.
  26.135 -     * <p>
  26.136 -     * The <code>flush</code> method of <code>FilterOutputStream</code>
  26.137 -     * calls the <code>flush</code> method of its underlying output stream.
  26.138 -     *
  26.139 -     * @exception  IOException  if an I/O error occurs.
  26.140 -     * @see        java.io.FilterOutputStream#out
  26.141 -     */
  26.142 -    public void flush() throws IOException {
  26.143 -        out.flush();
  26.144 -    }
  26.145 -
  26.146 -    /**
  26.147 -     * Closes this output stream and releases any system resources
  26.148 -     * associated with the stream.
  26.149 -     * <p>
  26.150 -     * The <code>close</code> method of <code>FilterOutputStream</code>
  26.151 -     * calls its <code>flush</code> method, and then calls the
  26.152 -     * <code>close</code> method of its underlying output stream.
  26.153 -     *
  26.154 -     * @exception  IOException  if an I/O error occurs.
  26.155 -     * @see        java.io.FilterOutputStream#flush()
  26.156 -     * @see        java.io.FilterOutputStream#out
  26.157 -     */
  26.158 -    public void close() throws IOException {
  26.159 -        try {
  26.160 -          flush();
  26.161 -        } catch (IOException ignored) {
  26.162 -        }
  26.163 -        out.close();
  26.164 -    }
  26.165 -}
    27.1 --- a/emul/compact/src/main/java/java/io/Flushable.java	Mon Feb 25 19:00:08 2013 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,47 +0,0 @@
    27.4 -/*
    27.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
    27.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.7 - *
    27.8 - * This code is free software; you can redistribute it and/or modify it
    27.9 - * under the terms of the GNU General Public License version 2 only, as
   27.10 - * published by the Free Software Foundation.  Oracle designates this
   27.11 - * particular file as subject to the "Classpath" exception as provided
   27.12 - * by Oracle in the LICENSE file that accompanied this code.
   27.13 - *
   27.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   27.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   27.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   27.17 - * version 2 for more details (a copy is included in the LICENSE file that
   27.18 - * accompanied this code).
   27.19 - *
   27.20 - * You should have received a copy of the GNU General Public License version
   27.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   27.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   27.23 - *
   27.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   27.25 - * or visit www.oracle.com if you need additional information or have any
   27.26 - * questions.
   27.27 - */
   27.28 -
   27.29 -package java.io;
   27.30 -
   27.31 -import java.io.IOException;
   27.32 -
   27.33 -/**
   27.34 - * A <tt>Flushable</tt> is a destination of data that can be flushed.  The
   27.35 - * flush method is invoked to write any buffered output to the underlying
   27.36 - * stream.
   27.37 - *
   27.38 - * @since 1.5
   27.39 - */
   27.40 -
   27.41 -public interface Flushable {
   27.42 -
   27.43 -    /**
   27.44 -     * Flushes this stream by writing any buffered output to the underlying
   27.45 -     * stream.
   27.46 -     *
   27.47 -     * @throws IOException If an I/O error occurs
   27.48 -     */
   27.49 -    void flush() throws IOException;
   27.50 -}
    28.1 --- a/emul/compact/src/main/java/java/io/InputStreamReader.java	Mon Feb 25 19:00:08 2013 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,230 +0,0 @@
    28.4 -/*
    28.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    28.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 - *
    28.8 - * This code is free software; you can redistribute it and/or modify it
    28.9 - * under the terms of the GNU General Public License version 2 only, as
   28.10 - * published by the Free Software Foundation.  Oracle designates this
   28.11 - * particular file as subject to the "Classpath" exception as provided
   28.12 - * by Oracle in the LICENSE file that accompanied this code.
   28.13 - *
   28.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   28.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.17 - * version 2 for more details (a copy is included in the LICENSE file that
   28.18 - * accompanied this code).
   28.19 - *
   28.20 - * You should have received a copy of the GNU General Public License version
   28.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   28.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.23 - *
   28.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.25 - * or visit www.oracle.com if you need additional information or have any
   28.26 - * questions.
   28.27 - */
   28.28 -
   28.29 -package java.io;
   28.30 -
   28.31 -
   28.32 -/**
   28.33 - * An InputStreamReader is a bridge from byte streams to character streams: It
   28.34 - * reads bytes and decodes them into characters using a specified {@link
   28.35 - * java.nio.charset.Charset <code>charset</code>}.  The charset that it uses
   28.36 - * may be specified by name or may be given explicitly, or the platform's
   28.37 - * default charset may be accepted.
   28.38 - *
   28.39 - * <p> Each invocation of one of an InputStreamReader's read() methods may
   28.40 - * cause one or more bytes to be read from the underlying byte-input stream.
   28.41 - * To enable the efficient conversion of bytes to characters, more bytes may
   28.42 - * be read ahead from the underlying stream than are necessary to satisfy the
   28.43 - * current read operation.
   28.44 - *
   28.45 - * <p> For top efficiency, consider wrapping an InputStreamReader within a
   28.46 - * BufferedReader.  For example:
   28.47 - *
   28.48 - * <pre>
   28.49 - * BufferedReader in
   28.50 - *   = new BufferedReader(new InputStreamReader(System.in));
   28.51 - * </pre>
   28.52 - *
   28.53 - * @see BufferedReader
   28.54 - * @see InputStream
   28.55 - * @see java.nio.charset.Charset
   28.56 - *
   28.57 - * @author      Mark Reinhold
   28.58 - * @since       JDK1.1
   28.59 - */
   28.60 -
   28.61 -public class InputStreamReader extends Reader {
   28.62 -
   28.63 -    /**
   28.64 -     * Creates an InputStreamReader that uses the default charset.
   28.65 -     *
   28.66 -     * @param  in   An InputStream
   28.67 -     */
   28.68 -    public InputStreamReader(InputStream in) {
   28.69 -        super(in);
   28.70 -    }
   28.71 -
   28.72 -    /**
   28.73 -     * Creates an InputStreamReader that uses the named charset.
   28.74 -     *
   28.75 -     * @param  in
   28.76 -     *         An InputStream
   28.77 -     *
   28.78 -     * @param  charsetName
   28.79 -     *         The name of a supported
   28.80 -     *         {@link java.nio.charset.Charset </code>charset<code>}
   28.81 -     *
   28.82 -     * @exception  UnsupportedEncodingException
   28.83 -     *             If the named charset is not supported
   28.84 -     */
   28.85 -    public InputStreamReader(InputStream in, String charsetName)
   28.86 -        throws UnsupportedEncodingException
   28.87 -    {
   28.88 -        super(in);
   28.89 -        if (!charsetName.toUpperCase().equals("UTF-8")) {
   28.90 -            throw new UnsupportedEncodingException(charsetName);
   28.91 -        }
   28.92 -    }
   28.93 -
   28.94 -    /**
   28.95 -     * Creates an InputStreamReader that uses the given charset. </p>
   28.96 -     *
   28.97 -     * @param  in       An InputStream
   28.98 -     * @param  cs       A charset
   28.99 -     *
  28.100 -     * @since 1.4
  28.101 -     * @spec JSR-51
  28.102 -     */
  28.103 -/* XXX:
  28.104 -    public InputStreamReader(InputStream in, Charset cs) {
  28.105 -        super(in);
  28.106 -        if (cs == null)
  28.107 -            throw new NullPointerException("charset");
  28.108 -        sd = StreamDecoder.forInputStreamReader(in, this, cs);
  28.109 -    }
  28.110 -*/
  28.111 -    /**
  28.112 -     * Creates an InputStreamReader that uses the given charset decoder.  </p>
  28.113 -     *
  28.114 -     * @param  in       An InputStream
  28.115 -     * @param  dec      A charset decoder
  28.116 -     *
  28.117 -     * @since 1.4
  28.118 -     * @spec JSR-51
  28.119 -     */
  28.120 -/* XXX:
  28.121 -    public InputStreamReader(InputStream in, CharsetDecoder dec) {
  28.122 -        super(in);
  28.123 -        if (dec == null)
  28.124 -            throw new NullPointerException("charset decoder");
  28.125 -        sd = StreamDecoder.forInputStreamReader(in, this, dec);
  28.126 -    }
  28.127 -*/
  28.128 -    
  28.129 -    /**
  28.130 -     * Returns the name of the character encoding being used by this stream.
  28.131 -     *
  28.132 -     * <p> If the encoding has an historical name then that name is returned;
  28.133 -     * otherwise the encoding's canonical name is returned.
  28.134 -     *
  28.135 -     * <p> If this instance was created with the {@link
  28.136 -     * #InputStreamReader(InputStream, String)} constructor then the returned
  28.137 -     * name, being unique for the encoding, may differ from the name passed to
  28.138 -     * the constructor. This method will return <code>null</code> if the
  28.139 -     * stream has been closed.
  28.140 -     * </p>
  28.141 -     * @return The historical name of this encoding, or
  28.142 -     *         <code>null</code> if the stream has been closed
  28.143 -     *
  28.144 -     * @see java.nio.charset.Charset
  28.145 -     *
  28.146 -     * @revised 1.4
  28.147 -     * @spec JSR-51
  28.148 -     */
  28.149 -    public String getEncoding() {
  28.150 -        return "UTF-8";
  28.151 -    }
  28.152 -
  28.153 -    /**
  28.154 -     * Reads a single character.
  28.155 -     *
  28.156 -     * @return The character read, or -1 if the end of the stream has been
  28.157 -     *         reached
  28.158 -     *
  28.159 -     * @exception  IOException  If an I/O error occurs
  28.160 -     */
  28.161 -    public int read() throws IOException {
  28.162 -        final InputStream is = (InputStream)lock;
  28.163 -        int c = is.read();
  28.164 -        if (c == -1) {
  28.165 -            return -1;
  28.166 -        }
  28.167 -        c = (int) c & 0xff;
  28.168 -        switch (c >> 4) {
  28.169 -            case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
  28.170 -                /* 0xxxxxxx*/
  28.171 -                return c;
  28.172 -            case 12: case 13: {
  28.173 -                /* 110x xxxx   10xx xxxx*/
  28.174 -                int char2 = (int) is.read();
  28.175 -                if ((char2 & 0xC0) != 0x80)
  28.176 -                    throw new UTFDataFormatException("malformed input");
  28.177 -                return (((c & 0x1F) << 6) | (char2 & 0x3F));
  28.178 -            }
  28.179 -            case 14: {
  28.180 -                /* 1110 xxxx  10xx xxxx  10xx xxxx */
  28.181 -                int char2 = is.read();
  28.182 -                int char3 = is.read();
  28.183 -                if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80))
  28.184 -                    throw new UTFDataFormatException("malformed input");
  28.185 -                return (((c    & 0x0F) << 12) |
  28.186 -                       ((char2 & 0x3F) << 6)  |
  28.187 -                       ((char3 & 0x3F) << 0));
  28.188 -            }
  28.189 -            default:
  28.190 -                /* 10xx xxxx,  1111 xxxx */
  28.191 -                throw new UTFDataFormatException("malformed input");
  28.192 -        }
  28.193 -    }
  28.194 -    
  28.195 -    /**
  28.196 -     * Reads characters into a portion of an array.
  28.197 -     *
  28.198 -     * @param      cbuf     Destination buffer
  28.199 -     * @param      offset   Offset at which to start storing characters
  28.200 -     * @param      length   Maximum number of characters to read
  28.201 -     *
  28.202 -     * @return     The number of characters read, or -1 if the end of the
  28.203 -     *             stream has been reached
  28.204 -     *
  28.205 -     * @exception  IOException  If an I/O error occurs
  28.206 -     */
  28.207 -    public int read(char cbuf[], int offset, int length) throws IOException {
  28.208 -        for (int i = 0; i < length; i++) {
  28.209 -            int ch = read();
  28.210 -            if (ch == -1) {
  28.211 -                if (i == 0) return -1;
  28.212 -                return i;
  28.213 -            }
  28.214 -            cbuf[offset++] = (char) ch;
  28.215 -        }
  28.216 -        return length;
  28.217 -    }
  28.218 -
  28.219 -    /**
  28.220 -     * Tells whether this stream is ready to be read.  An InputStreamReader is
  28.221 -     * ready if its input buffer is not empty, or if bytes are available to be
  28.222 -     * read from the underlying byte stream.
  28.223 -     *
  28.224 -     * @exception  IOException  If an I/O error occurs
  28.225 -     */
  28.226 -    public boolean ready() throws IOException {
  28.227 -        return ((InputStream)lock).available() > 0;
  28.228 -    }
  28.229 -
  28.230 -    public void close() throws IOException {
  28.231 -        ((InputStream)lock).close();
  28.232 -    }
  28.233 -}
    29.1 --- a/emul/compact/src/main/java/java/io/InvalidClassException.java	Mon Feb 25 19:00:08 2013 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,81 +0,0 @@
    29.4 -/*
    29.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
    29.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 - *
    29.8 - * This code is free software; you can redistribute it and/or modify it
    29.9 - * under the terms of the GNU General Public License version 2 only, as
   29.10 - * published by the Free Software Foundation.  Oracle designates this
   29.11 - * particular file as subject to the "Classpath" exception as provided
   29.12 - * by Oracle in the LICENSE file that accompanied this code.
   29.13 - *
   29.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   29.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.17 - * version 2 for more details (a copy is included in the LICENSE file that
   29.18 - * accompanied this code).
   29.19 - *
   29.20 - * You should have received a copy of the GNU General Public License version
   29.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   29.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.23 - *
   29.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.25 - * or visit www.oracle.com if you need additional information or have any
   29.26 - * questions.
   29.27 - */
   29.28 -
   29.29 -package java.io;
   29.30 -
   29.31 -/**
   29.32 - * Thrown when the Serialization runtime detects one of the following
   29.33 - * problems with a Class.
   29.34 - * <UL>
   29.35 - * <LI> The serial version of the class does not match that of the class
   29.36 - *      descriptor read from the stream
   29.37 - * <LI> The class contains unknown datatypes
   29.38 - * <LI> The class does not have an accessible no-arg constructor
   29.39 - * </UL>
   29.40 - *
   29.41 - * @author  unascribed
   29.42 - * @since   JDK1.1
   29.43 - */
   29.44 -public class InvalidClassException extends ObjectStreamException {
   29.45 -
   29.46 -    private static final long serialVersionUID = -4333316296251054416L;
   29.47 -
   29.48 -    /**
   29.49 -     * Name of the invalid class.
   29.50 -     *
   29.51 -     * @serial Name of the invalid class.
   29.52 -     */
   29.53 -    public String classname;
   29.54 -
   29.55 -    /**
   29.56 -     * Report an InvalidClassException for the reason specified.
   29.57 -     *
   29.58 -     * @param reason  String describing the reason for the exception.
   29.59 -     */
   29.60 -    public InvalidClassException(String reason) {
   29.61 -        super(reason);
   29.62 -    }
   29.63 -
   29.64 -    /**
   29.65 -     * Constructs an InvalidClassException object.
   29.66 -     *
   29.67 -     * @param cname   a String naming the invalid class.
   29.68 -     * @param reason  a String describing the reason for the exception.
   29.69 -     */
   29.70 -    public InvalidClassException(String cname, String reason) {
   29.71 -        super(reason);
   29.72 -        classname = cname;
   29.73 -    }
   29.74 -
   29.75 -    /**
   29.76 -     * Produce the message and include the classname, if present.
   29.77 -     */
   29.78 -    public String getMessage() {
   29.79 -        if (classname == null)
   29.80 -            return super.getMessage();
   29.81 -        else
   29.82 -            return classname + "; " + super.getMessage();
   29.83 -    }
   29.84 -}
    30.1 --- a/emul/compact/src/main/java/java/io/InvalidObjectException.java	Mon Feb 25 19:00:08 2013 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,51 +0,0 @@
    30.4 -/*
    30.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    30.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 - *
    30.8 - * This code is free software; you can redistribute it and/or modify it
    30.9 - * under the terms of the GNU General Public License version 2 only, as
   30.10 - * published by the Free Software Foundation.  Oracle designates this
   30.11 - * particular file as subject to the "Classpath" exception as provided
   30.12 - * by Oracle in the LICENSE file that accompanied this code.
   30.13 - *
   30.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   30.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.17 - * version 2 for more details (a copy is included in the LICENSE file that
   30.18 - * accompanied this code).
   30.19 - *
   30.20 - * You should have received a copy of the GNU General Public License version
   30.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   30.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.23 - *
   30.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.25 - * or visit www.oracle.com if you need additional information or have any
   30.26 - * questions.
   30.27 - */
   30.28 -
   30.29 -package java.io;
   30.30 -
   30.31 -/**
   30.32 - * Indicates that one or more deserialized objects failed validation
   30.33 - * tests.  The argument should provide the reason for the failure.
   30.34 - *
   30.35 - * @see ObjectInputValidation
   30.36 - * @since JDK1.1
   30.37 - *
   30.38 - * @author  unascribed
   30.39 - * @since   JDK1.1
   30.40 - */
   30.41 -public class InvalidObjectException extends ObjectStreamException {
   30.42 -
   30.43 -    private static final long serialVersionUID = 3233174318281839583L;
   30.44 -
   30.45 -    /**
   30.46 -     * Constructs an <code>InvalidObjectException</code>.
   30.47 -     * @param reason Detailed message explaining the reason for the failure.
   30.48 -     *
   30.49 -     * @see ObjectInputValidation
   30.50 -     */
   30.51 -    public  InvalidObjectException(String reason) {
   30.52 -        super(reason);
   30.53 -    }
   30.54 -}
    31.1 --- a/emul/compact/src/main/java/java/io/NotActiveException.java	Mon Feb 25 19:00:08 2013 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,53 +0,0 @@
    31.4 -/*
    31.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    31.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 - *
    31.8 - * This code is free software; you can redistribute it and/or modify it
    31.9 - * under the terms of the GNU General Public License version 2 only, as
   31.10 - * published by the Free Software Foundation.  Oracle designates this
   31.11 - * particular file as subject to the "Classpath" exception as provided
   31.12 - * by Oracle in the LICENSE file that accompanied this code.
   31.13 - *
   31.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   31.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.17 - * version 2 for more details (a copy is included in the LICENSE file that
   31.18 - * accompanied this code).
   31.19 - *
   31.20 - * You should have received a copy of the GNU General Public License version
   31.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   31.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.23 - *
   31.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.25 - * or visit www.oracle.com if you need additional information or have any
   31.26 - * questions.
   31.27 - */
   31.28 -
   31.29 -package java.io;
   31.30 -
   31.31 -/**
   31.32 - * Thrown when serialization or deserialization is not active.
   31.33 - *
   31.34 - * @author  unascribed
   31.35 - * @since   JDK1.1
   31.36 - */
   31.37 -public class NotActiveException extends ObjectStreamException {
   31.38 -
   31.39 -    private static final long serialVersionUID = -3893467273049808895L;
   31.40 -
   31.41 -    /**
   31.42 -     * Constructor to create a new NotActiveException with the reason given.
   31.43 -     *
   31.44 -     * @param reason  a String describing the reason for the exception.
   31.45 -     */
   31.46 -    public NotActiveException(String reason) {
   31.47 -        super(reason);
   31.48 -    }
   31.49 -
   31.50 -    /**
   31.51 -     * Constructor to create a new NotActiveException without a reason.
   31.52 -     */
   31.53 -    public NotActiveException() {
   31.54 -        super();
   31.55 -    }
   31.56 -}
    32.1 --- a/emul/compact/src/main/java/java/io/NotSerializableException.java	Mon Feb 25 19:00:08 2013 +0100
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,55 +0,0 @@
    32.4 -/*
    32.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    32.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 - *
    32.8 - * This code is free software; you can redistribute it and/or modify it
    32.9 - * under the terms of the GNU General Public License version 2 only, as
   32.10 - * published by the Free Software Foundation.  Oracle designates this
   32.11 - * particular file as subject to the "Classpath" exception as provided
   32.12 - * by Oracle in the LICENSE file that accompanied this code.
   32.13 - *
   32.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   32.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.17 - * version 2 for more details (a copy is included in the LICENSE file that
   32.18 - * accompanied this code).
   32.19 - *
   32.20 - * You should have received a copy of the GNU General Public License version
   32.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   32.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.23 - *
   32.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.25 - * or visit www.oracle.com if you need additional information or have any
   32.26 - * questions.
   32.27 - */
   32.28 -
   32.29 -package java.io;
   32.30 -
   32.31 -/**
   32.32 - * Thrown when an instance is required to have a Serializable interface.
   32.33 - * The serialization runtime or the class of the instance can throw
   32.34 - * this exception. The argument should be the name of the class.
   32.35 - *
   32.36 - * @author  unascribed
   32.37 - * @since   JDK1.1
   32.38 - */
   32.39 -public class NotSerializableException extends ObjectStreamException {
   32.40 -
   32.41 -    private static final long serialVersionUID = 2906642554793891381L;
   32.42 -
   32.43 -    /**
   32.44 -     * Constructs a NotSerializableException object with message string.
   32.45 -     *
   32.46 -     * @param classname Class of the instance being serialized/deserialized.
   32.47 -     */
   32.48 -    public NotSerializableException(String classname) {
   32.49 -        super(classname);
   32.50 -    }
   32.51 -
   32.52 -    /**
   32.53 -     *  Constructs a NotSerializableException object.
   32.54 -     */
   32.55 -    public NotSerializableException() {
   32.56 -        super();
   32.57 -    }
   32.58 -}
    33.1 --- a/emul/compact/src/main/java/java/io/ObjectInput.java	Mon Feb 25 19:00:08 2013 +0100
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,107 +0,0 @@
    33.4 -/*
    33.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    33.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 - *
    33.8 - * This code is free software; you can redistribute it and/or modify it
    33.9 - * under the terms of the GNU General Public License version 2 only, as
   33.10 - * published by the Free Software Foundation.  Oracle designates this
   33.11 - * particular file as subject to the "Classpath" exception as provided
   33.12 - * by Oracle in the LICENSE file that accompanied this code.
   33.13 - *
   33.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   33.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.17 - * version 2 for more details (a copy is included in the LICENSE file that
   33.18 - * accompanied this code).
   33.19 - *
   33.20 - * You should have received a copy of the GNU General Public License version
   33.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   33.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.23 - *
   33.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.25 - * or visit www.oracle.com if you need additional information or have any
   33.26 - * questions.
   33.27 - */
   33.28 -
   33.29 -package java.io;
   33.30 -
   33.31 -/**
   33.32 - * ObjectInput extends the DataInput interface to include the reading of
   33.33 - * objects. DataInput includes methods for the input of primitive types,
   33.34 - * ObjectInput extends that interface to include objects, arrays, and Strings.
   33.35 - *
   33.36 - * @author  unascribed
   33.37 - * @see java.io.InputStream
   33.38 - * @see java.io.ObjectOutputStream
   33.39 - * @see java.io.ObjectInputStream
   33.40 - * @since   JDK1.1
   33.41 - */
   33.42 -public interface ObjectInput extends DataInput, AutoCloseable {
   33.43 -    /**
   33.44 -     * Read and return an object. The class that implements this interface
   33.45 -     * defines where the object is "read" from.
   33.46 -     *
   33.47 -     * @return the object read from the stream
   33.48 -     * @exception java.lang.ClassNotFoundException If the class of a serialized
   33.49 -     *      object cannot be found.
   33.50 -     * @exception IOException If any of the usual Input/Output
   33.51 -     * related exceptions occur.
   33.52 -     */
   33.53 -    public Object readObject()
   33.54 -        throws ClassNotFoundException, IOException;
   33.55 -
   33.56 -    /**
   33.57 -     * Reads a byte of data. This method will block if no input is
   33.58 -     * available.
   33.59 -     * @return  the byte read, or -1 if the end of the
   33.60 -     *          stream is reached.
   33.61 -     * @exception IOException If an I/O error has occurred.
   33.62 -     */
   33.63 -    public int read() throws IOException;
   33.64 -
   33.65 -    /**
   33.66 -     * Reads into an array of bytes.  This method will
   33.67 -     * block until some input is available.
   33.68 -     * @param b the buffer into which the data is read
   33.69 -     * @return  the actual number of bytes read, -1 is
   33.70 -     *          returned when the end of the stream is reached.
   33.71 -     * @exception IOException If an I/O error has occurred.
   33.72 -     */
   33.73 -    public int read(byte b[]) throws IOException;
   33.74 -
   33.75 -    /**
   33.76 -     * Reads into an array of bytes.  This method will
   33.77 -     * block until some input is available.
   33.78 -     * @param b the buffer into which the data is read
   33.79 -     * @param off the start offset of the data
   33.80 -     * @param len the maximum number of bytes read
   33.81 -     * @return  the actual number of bytes read, -1 is
   33.82 -     *          returned when the end of the stream is reached.
   33.83 -     * @exception IOException If an I/O error has occurred.
   33.84 -     */
   33.85 -    public int read(byte b[], int off, int len) throws IOException;
   33.86 -
   33.87 -    /**
   33.88 -     * Skips n bytes of input.
   33.89 -     * @param n the number of bytes to be skipped
   33.90 -     * @return  the actual number of bytes skipped.
   33.91 -     * @exception IOException If an I/O error has occurred.
   33.92 -     */
   33.93 -    public long skip(long n) throws IOException;
   33.94 -
   33.95 -    /**
   33.96 -     * Returns the number of bytes that can be read
   33.97 -     * without blocking.
   33.98 -     * @return the number of available bytes.
   33.99 -     * @exception IOException If an I/O error has occurred.
  33.100 -     */
  33.101 -    public int available() throws IOException;
  33.102 -
  33.103 -    /**
  33.104 -     * Closes the input stream. Must be called
  33.105 -     * to release any resources associated with
  33.106 -     * the stream.
  33.107 -     * @exception IOException If an I/O error has occurred.
  33.108 -     */
  33.109 -    public void close() throws IOException;
  33.110 -}
    34.1 --- a/emul/compact/src/main/java/java/io/ObjectInputStream.java	Mon Feb 25 19:00:08 2013 +0100
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,3357 +0,0 @@
    34.4 -/*
    34.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    34.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 - *
    34.8 - * This code is free software; you can redistribute it and/or modify it
    34.9 - * under the terms of the GNU General Public License version 2 only, as
   34.10 - * published by the Free Software Foundation.  Oracle designates this
   34.11 - * particular file as subject to the "Classpath" exception as provided
   34.12 - * by Oracle in the LICENSE file that accompanied this code.
   34.13 - *
   34.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   34.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.17 - * version 2 for more details (a copy is included in the LICENSE file that
   34.18 - * accompanied this code).
   34.19 - *
   34.20 - * You should have received a copy of the GNU General Public License version
   34.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   34.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.23 - *
   34.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.25 - * or visit www.oracle.com if you need additional information or have any
   34.26 - * questions.
   34.27 - */
   34.28 -
   34.29 -package java.io;
   34.30 -
   34.31 -import java.lang.reflect.Array;
   34.32 -import java.lang.reflect.Modifier;
   34.33 -import java.lang.reflect.Proxy;
   34.34 -import java.util.Arrays;
   34.35 -import java.util.HashMap;
   34.36 -import org.apidesign.bck2brwsr.emul.lang.System;
   34.37 -
   34.38 -/**
   34.39 - * An ObjectInputStream deserializes primitive data and objects previously
   34.40 - * written using an ObjectOutputStream.
   34.41 - *
   34.42 - * <p>ObjectOutputStream and ObjectInputStream can provide an application with
   34.43 - * persistent storage for graphs of objects when used with a FileOutputStream
   34.44 - * and FileInputStream respectively.  ObjectInputStream is used to recover
   34.45 - * those objects previously serialized. Other uses include passing objects
   34.46 - * between hosts using a socket stream or for marshaling and unmarshaling
   34.47 - * arguments and parameters in a remote communication system.
   34.48 - *
   34.49 - * <p>ObjectInputStream ensures that the types of all objects in the graph
   34.50 - * created from the stream match the classes present in the Java Virtual
   34.51 - * Machine.  Classes are loaded as required using the standard mechanisms.
   34.52 - *
   34.53 - * <p>Only objects that support the java.io.Serializable or
   34.54 - * java.io.Externalizable interface can be read from streams.
   34.55 - *
   34.56 - * <p>The method <code>readObject</code> is used to read an object from the
   34.57 - * stream.  Java's safe casting should be used to get the desired type.  In
   34.58 - * Java, strings and arrays are objects and are treated as objects during
   34.59 - * serialization. When read they need to be cast to the expected type.
   34.60 - *
   34.61 - * <p>Primitive data types can be read from the stream using the appropriate
   34.62 - * method on DataInput.
   34.63 - *
   34.64 - * <p>The default deserialization mechanism for objects restores the contents
   34.65 - * of each field to the value and type it had when it was written.  Fields
   34.66 - * declared as transient or static are ignored by the deserialization process.
   34.67 - * References to other objects cause those objects to be read from the stream
   34.68 - * as necessary.  Graphs of objects are restored correctly using a reference
   34.69 - * sharing mechanism.  New objects are always allocated when deserializing,
   34.70 - * which prevents existing objects from being overwritten.
   34.71 - *
   34.72 - * <p>Reading an object is analogous to running the constructors of a new
   34.73 - * object.  Memory is allocated for the object and initialized to zero (NULL).
   34.74 - * No-arg constructors are invoked for the non-serializable classes and then
   34.75 - * the fields of the serializable classes are restored from the stream starting
   34.76 - * with the serializable class closest to java.lang.object and finishing with
   34.77 - * the object's most specific class.
   34.78 - *
   34.79 - * <p>For example to read from a stream as written by the example in
   34.80 - * ObjectOutputStream:
   34.81 - * <br>
   34.82 - * <pre>
   34.83 - *      FileInputStream fis = new FileInputStream("t.tmp");
   34.84 - *      ObjectInputStream ois = new ObjectInputStream(fis);
   34.85 - *
   34.86 - *      int i = ois.readInt();
   34.87 - *      String today = (String) ois.readObject();
   34.88 - *      Date date = (Date) ois.readObject();
   34.89 - *
   34.90 - *      ois.close();
   34.91 - * </pre>
   34.92 - *
   34.93 - * <p>Classes control how they are serialized by implementing either the
   34.94 - * java.io.Serializable or java.io.Externalizable interfaces.
   34.95 - *
   34.96 - * <p>Implementing the Serializable interface allows object serialization to
   34.97 - * save and restore the entire state of the object and it allows classes to
   34.98 - * evolve between the time the stream is written and the time it is read.  It
   34.99 - * automatically traverses references between objects, saving and restoring
  34.100 - * entire graphs.
  34.101 - *
  34.102 - * <p>Serializable classes that require special handling during the
  34.103 - * serialization and deserialization process should implement the following
  34.104 - * methods:<p>
  34.105 - *
  34.106 - * <pre>
  34.107 - * private void writeObject(java.io.ObjectOutputStream stream)
  34.108 - *     throws IOException;
  34.109 - * private void readObject(java.io.ObjectInputStream stream)
  34.110 - *     throws IOException, ClassNotFoundException;
  34.111 - * private void readObjectNoData()
  34.112 - *     throws ObjectStreamException;
  34.113 - * </pre>
  34.114 - *
  34.115 - * <p>The readObject method is responsible for reading and restoring the state
  34.116 - * of the object for its particular class using data written to the stream by
  34.117 - * the corresponding writeObject method.  The method does not need to concern
  34.118 - * itself with the state belonging to its superclasses or subclasses.  State is
  34.119 - * restored by reading data from the ObjectInputStream for the individual
  34.120 - * fields and making assignments to the appropriate fields of the object.
  34.121 - * Reading primitive data types is supported by DataInput.
  34.122 - *
  34.123 - * <p>Any attempt to read object data which exceeds the boundaries of the
  34.124 - * custom data written by the corresponding writeObject method will cause an
  34.125 - * OptionalDataException to be thrown with an eof field value of true.
  34.126 - * Non-object reads which exceed the end of the allotted data will reflect the
  34.127 - * end of data in the same way that they would indicate the end of the stream:
  34.128 - * bytewise reads will return -1 as the byte read or number of bytes read, and
  34.129 - * primitive reads will throw EOFExceptions.  If there is no corresponding
  34.130 - * writeObject method, then the end of default serialized data marks the end of
  34.131 - * the allotted data.
  34.132 - *
  34.133 - * <p>Primitive and object read calls issued from within a readExternal method
  34.134 - * behave in the same manner--if the stream is already positioned at the end of
  34.135 - * data written by the corresponding writeExternal method, object reads will
  34.136 - * throw OptionalDataExceptions with eof set to true, bytewise reads will
  34.137 - * return -1, and primitive reads will throw EOFExceptions.  Note that this
  34.138 - * behavior does not hold for streams written with the old
  34.139 - * <code>ObjectStreamConstants.PROTOCOL_VERSION_1</code> protocol, in which the
  34.140 - * end of data written by writeExternal methods is not demarcated, and hence
  34.141 - * cannot be detected.
  34.142 - *
  34.143 - * <p>The readObjectNoData method is responsible for initializing the state of
  34.144 - * the object for its particular class in the event that the serialization
  34.145 - * stream does not list the given class as a superclass of the object being
  34.146 - * deserialized.  This may occur in cases where the receiving party uses a
  34.147 - * different version of the deserialized instance's class than the sending
  34.148 - * party, and the receiver's version extends classes that are not extended by
  34.149 - * the sender's version.  This may also occur if the serialization stream has
  34.150 - * been tampered; hence, readObjectNoData is useful for initializing
  34.151 - * deserialized objects properly despite a "hostile" or incomplete source
  34.152 - * stream.
  34.153 - *
  34.154 - * <p>Serialization does not read or assign values to the fields of any object
  34.155 - * that does not implement the java.io.Serializable interface.  Subclasses of
  34.156 - * Objects that are not serializable can be serializable. In this case the
  34.157 - * non-serializable class must have a no-arg constructor to allow its fields to
  34.158 - * be initialized.  In this case it is the responsibility of the subclass to
  34.159 - * save and restore the state of the non-serializable class. It is frequently
  34.160 - * the case that the fields of that class are accessible (public, package, or
  34.161 - * protected) or that there are get and set methods that can be used to restore
  34.162 - * the state.
  34.163 - *
  34.164 - * <p>Any exception that occurs while deserializing an object will be caught by
  34.165 - * the ObjectInputStream and abort the reading process.
  34.166 - *
  34.167 - * <p>Implementing the Externalizable interface allows the object to assume
  34.168 - * complete control over the contents and format of the object's serialized
  34.169 - * form.  The methods of the Externalizable interface, writeExternal and
  34.170 - * readExternal, are called to save and restore the objects state.  When
  34.171 - * implemented by a class they can write and read their own state using all of
  34.172 - * the methods of ObjectOutput and ObjectInput.  It is the responsibility of
  34.173 - * the objects to handle any versioning that occurs.
  34.174 - *
  34.175 - * <p>Enum constants are deserialized differently than ordinary serializable or
  34.176 - * externalizable objects.  The serialized form of an enum constant consists
  34.177 - * solely of its name; field values of the constant are not transmitted.  To
  34.178 - * deserialize an enum constant, ObjectInputStream reads the constant name from
  34.179 - * the stream; the deserialized constant is then obtained by calling the static
  34.180 - * method <code>Enum.valueOf(Class, String)</code> with the enum constant's
  34.181 - * base type and the received constant name as arguments.  Like other
  34.182 - * serializable or externalizable objects, enum constants can function as the
  34.183 - * targets of back references appearing subsequently in the serialization
  34.184 - * stream.  The process by which enum constants are deserialized cannot be
  34.185 - * customized: any class-specific readObject, readObjectNoData, and readResolve
  34.186 - * methods defined by enum types are ignored during deserialization.
  34.187 - * Similarly, any serialPersistentFields or serialVersionUID field declarations
  34.188 - * are also ignored--all enum types have a fixed serialVersionUID of 0L.
  34.189 - *
  34.190 - * @author      Mike Warres
  34.191 - * @author      Roger Riggs
  34.192 - * @see java.io.DataInput
  34.193 - * @see java.io.ObjectOutputStream
  34.194 - * @see java.io.Serializable
  34.195 - * @see <a href="../../../platform/serialization/spec/input.html"> Object Serialization Specification, Section 3, Object Input Classes</a>
  34.196 - * @since   JDK1.1
  34.197 - */
  34.198 -public class ObjectInputStream
  34.199 -    extends InputStream implements ObjectInput, ObjectStreamConstants
  34.200 -{
  34.201 -    /** handle value representing null */
  34.202 -    private static final int NULL_HANDLE = -1;
  34.203 -
  34.204 -    /** marker for unshared objects in internal handle table */
  34.205 -    private static final Object unsharedMarker = new Object();
  34.206 -
  34.207 -    /** table mapping primitive type names to corresponding class objects */
  34.208 -    private static final HashMap<String, Class<?>> primClasses
  34.209 -        = new HashMap<>(8, 1.0F);
  34.210 -    static {
  34.211 -        primClasses.put("boolean", boolean.class);
  34.212 -        primClasses.put("byte", byte.class);
  34.213 -        primClasses.put("char", char.class);
  34.214 -        primClasses.put("short", short.class);
  34.215 -        primClasses.put("int", int.class);
  34.216 -        primClasses.put("long", long.class);
  34.217 -        primClasses.put("float", float.class);
  34.218 -        primClasses.put("double", double.class);
  34.219 -        primClasses.put("void", void.class);
  34.220 -    }
  34.221 -
  34.222 -    /** filter stream for handling block data conversion */
  34.223 -    private final BlockDataInputStream bin;
  34.224 -    /** validation callback list */
  34.225 -    private final ValidationList vlist;
  34.226 -    /** recursion depth */
  34.227 -    private int depth;
  34.228 -    /** whether stream is closed */
  34.229 -    private boolean closed;
  34.230 -
  34.231 -    /** wire handle -> obj/exception map */
  34.232 -    private final HandleTable handles;
  34.233 -    /** scratch field for passing handle values up/down call stack */
  34.234 -    private int passHandle = NULL_HANDLE;
  34.235 -    /** flag set when at end of field value block with no TC_ENDBLOCKDATA */
  34.236 -    private boolean defaultDataEnd = false;
  34.237 -
  34.238 -    /** buffer for reading primitive field values */
  34.239 -    private byte[] primVals;
  34.240 -
  34.241 -    /** if true, invoke readObjectOverride() instead of readObject() */
  34.242 -    private final boolean enableOverride;
  34.243 -    /** if true, invoke resolveObject() */
  34.244 -    private boolean enableResolve;
  34.245 -
  34.246 -    /**
  34.247 -     * Context during upcalls to class-defined readObject methods; holds
  34.248 -     * object currently being deserialized and descriptor for current class.
  34.249 -     * Null when not during readObject upcall.
  34.250 -     */
  34.251 -    private Object curContext;
  34.252 -
  34.253 -    /**
  34.254 -     * Creates an ObjectInputStream that reads from the specified InputStream.
  34.255 -     * A serialization stream header is read from the stream and verified.
  34.256 -     * This constructor will block until the corresponding ObjectOutputStream
  34.257 -     * has written and flushed the header.
  34.258 -     *
  34.259 -     * <p>If a security manager is installed, this constructor will check for
  34.260 -     * the "enableSubclassImplementation" SerializablePermission when invoked
  34.261 -     * directly or indirectly by the constructor of a subclass which overrides
  34.262 -     * the ObjectInputStream.readFields or ObjectInputStream.readUnshared
  34.263 -     * methods.
  34.264 -     *
  34.265 -     * @param   in input stream to read from
  34.266 -     * @throws  StreamCorruptedException if the stream header is incorrect
  34.267 -     * @throws  IOException if an I/O error occurs while reading stream header
  34.268 -     * @throws  SecurityException if untrusted subclass illegally overrides
  34.269 -     *          security-sensitive methods
  34.270 -     * @throws  NullPointerException if <code>in</code> is <code>null</code>
  34.271 -     * @see     ObjectInputStream#ObjectInputStream()
  34.272 -     * @see     ObjectInputStream#readFields()
  34.273 -     * @see     ObjectOutputStream#ObjectOutputStream(OutputStream)
  34.274 -     */
  34.275 -    public ObjectInputStream(InputStream in) throws IOException {
  34.276 -        verifySubclass();
  34.277 -        bin = new BlockDataInputStream(in);
  34.278 -        handles = new HandleTable(10);
  34.279 -        vlist = new ValidationList();
  34.280 -        enableOverride = false;
  34.281 -        readStreamHeader();
  34.282 -        bin.setBlockDataMode(true);
  34.283 -    }
  34.284 -
  34.285 -    /**
  34.286 -     * Provide a way for subclasses that are completely reimplementing
  34.287 -     * ObjectInputStream to not have to allocate private data just used by this
  34.288 -     * implementation of ObjectInputStream.
  34.289 -     *
  34.290 -     * <p>If there is a security manager installed, this method first calls the
  34.291 -     * security manager's <code>checkPermission</code> method with the
  34.292 -     * <code>SerializablePermission("enableSubclassImplementation")</code>
  34.293 -     * permission to ensure it's ok to enable subclassing.
  34.294 -     *
  34.295 -     * @throws  SecurityException if a security manager exists and its
  34.296 -     *          <code>checkPermission</code> method denies enabling
  34.297 -     *          subclassing.
  34.298 -     * @see SecurityManager#checkPermission
  34.299 -     * @see java.io.SerializablePermission
  34.300 -     */
  34.301 -    protected ObjectInputStream() throws IOException, SecurityException {
  34.302 -        throw new SecurityException();
  34.303 -    }
  34.304 -
  34.305 -    /**
  34.306 -     * Read an object from the ObjectInputStream.  The class of the object, the
  34.307 -     * signature of the class, and the values of the non-transient and
  34.308 -     * non-static fields of the class and all of its supertypes are read.
  34.309 -     * Default deserializing for a class can be overriden using the writeObject
  34.310 -     * and readObject methods.  Objects referenced by this object are read
  34.311 -     * transitively so that a complete equivalent graph of objects is
  34.312 -     * reconstructed by readObject.
  34.313 -     *
  34.314 -     * <p>The root object is completely restored when all of its fields and the
  34.315 -     * objects it references are completely restored.  At this point the object
  34.316 -     * validation callbacks are executed in order based on their registered
  34.317 -     * priorities. The callbacks are registered by objects (in the readObject
  34.318 -     * special methods) as they are individually restored.
  34.319 -     *
  34.320 -     * <p>Exceptions are thrown for problems with the InputStream and for
  34.321 -     * classes that should not be deserialized.  All exceptions are fatal to
  34.322 -     * the InputStream and leave it in an indeterminate state; it is up to the
  34.323 -     * caller to ignore or recover the stream state.
  34.324 -     *
  34.325 -     * @throws  ClassNotFoundException Class of a serialized object cannot be
  34.326 -     *          found.
  34.327 -     * @throws  InvalidClassException Something is wrong with a class used by
  34.328 -     *          serialization.
  34.329 -     * @throws  StreamCorruptedException Control information in the
  34.330 -     *          stream is inconsistent.
  34.331 -     * @throws  OptionalDataException Primitive data was found in the
  34.332 -     *          stream instead of objects.
  34.333 -     * @throws  IOException Any of the usual Input/Output related exceptions.
  34.334 -     */
  34.335 -    public final Object readObject()
  34.336 -        throws IOException, ClassNotFoundException
  34.337 -    {
  34.338 -        throw new IOException();
  34.339 -    }
  34.340 -
  34.341 -    /**
  34.342 -     * This method is called by trusted subclasses of ObjectOutputStream that
  34.343 -     * constructed ObjectOutputStream using the protected no-arg constructor.
  34.344 -     * The subclass is expected to provide an override method with the modifier
  34.345 -     * "final".
  34.346 -     *
  34.347 -     * @return  the Object read from the stream.
  34.348 -     * @throws  ClassNotFoundException Class definition of a serialized object
  34.349 -     *          cannot be found.
  34.350 -     * @throws  OptionalDataException Primitive data was found in the stream
  34.351 -     *          instead of objects.
  34.352 -     * @throws  IOException if I/O errors occurred while reading from the
  34.353 -     *          underlying stream
  34.354 -     * @see #ObjectInputStream()
  34.355 -     * @see #readObject()
  34.356 -     * @since 1.2
  34.357 -     */
  34.358 -    protected Object readObjectOverride()
  34.359 -        throws IOException, ClassNotFoundException
  34.360 -    {
  34.361 -        return null;
  34.362 -    }
  34.363 -
  34.364 -    /**
  34.365 -     * Reads an "unshared" object from the ObjectInputStream.  This method is
  34.366 -     * identical to readObject, except that it prevents subsequent calls to
  34.367 -     * readObject and readUnshared from returning additional references to the
  34.368 -     * deserialized instance obtained via this call.  Specifically:
  34.369 -     * <ul>
  34.370 -     *   <li>If readUnshared is called to deserialize a back-reference (the
  34.371 -     *       stream representation of an object which has been written
  34.372 -     *       previously to the stream), an ObjectStreamException will be
  34.373 -     *       thrown.
  34.374 -     *
  34.375 -     *   <li>If readUnshared returns successfully, then any subsequent attempts
  34.376 -     *       to deserialize back-references to the stream handle deserialized
  34.377 -     *       by readUnshared will cause an ObjectStreamException to be thrown.
  34.378 -     * </ul>
  34.379 -     * Deserializing an object via readUnshared invalidates the stream handle
  34.380 -     * associated with the returned object.  Note that this in itself does not
  34.381 -     * always guarantee that the reference returned by readUnshared is unique;
  34.382 -     * the deserialized object may define a readResolve method which returns an
  34.383 -     * object visible to other parties, or readUnshared may return a Class
  34.384 -     * object or enum constant obtainable elsewhere in the stream or through
  34.385 -     * external means. If the deserialized object defines a readResolve method
  34.386 -     * and the invocation of that method returns an array, then readUnshared
  34.387 -     * returns a shallow clone of that array; this guarantees that the returned
  34.388 -     * array object is unique and cannot be obtained a second time from an
  34.389 -     * invocation of readObject or readUnshared on the ObjectInputStream,
  34.390 -     * even if the underlying data stream has been manipulated.
  34.391 -     *
  34.392 -     * <p>ObjectInputStream subclasses which override this method can only be
  34.393 -     * constructed in security contexts possessing the
  34.394 -     * "enableSubclassImplementation" SerializablePermission; any attempt to
  34.395 -     * instantiate such a subclass without this permission will cause a
  34.396 -     * SecurityException to be thrown.
  34.397 -     *
  34.398 -     * @return  reference to deserialized object
  34.399 -     * @throws  ClassNotFoundException if class of an object to deserialize
  34.400 -     *          cannot be found
  34.401 -     * @throws  StreamCorruptedException if control information in the stream
  34.402 -     *          is inconsistent
  34.403 -     * @throws  ObjectStreamException if object to deserialize has already
  34.404 -     *          appeared in stream
  34.405 -     * @throws  OptionalDataException if primitive data is next in stream
  34.406 -     * @throws  IOException if an I/O error occurs during deserialization
  34.407 -     * @since   1.4
  34.408 -     */
  34.409 -    public Object readUnshared() throws IOException, ClassNotFoundException {
  34.410 -        // if nested read, passHandle contains handle of enclosing object
  34.411 -        int outerHandle = passHandle;
  34.412 -        try {
  34.413 -            Object obj = readObject0(true);
  34.414 -            handles.markDependency(outerHandle, passHandle);
  34.415 -            ClassNotFoundException ex = handles.lookupException(passHandle);
  34.416 -            if (ex != null) {
  34.417 -                throw ex;
  34.418 -            }
  34.419 -            if (depth == 0) {
  34.420 -                vlist.doCallbacks();
  34.421 -            }
  34.422 -            return obj;
  34.423 -        } finally {
  34.424 -            passHandle = outerHandle;
  34.425 -            if (closed && depth == 0) {
  34.426 -                clear();
  34.427 -            }
  34.428 -        }
  34.429 -    }
  34.430 -
  34.431 -    /**
  34.432 -     * Read the non-static and non-transient fields of the current class from
  34.433 -     * this stream.  This may only be called from the readObject method of the
  34.434 -     * class being deserialized. It will throw the NotActiveException if it is
  34.435 -     * called otherwise.
  34.436 -     *
  34.437 -     * @throws  ClassNotFoundException if the class of a serialized object
  34.438 -     *          could not be found.
  34.439 -     * @throws  IOException if an I/O error occurs.
  34.440 -     * @throws  NotActiveException if the stream is not currently reading
  34.441 -     *          objects.
  34.442 -     */
  34.443 -    public void defaultReadObject()
  34.444 -        throws IOException, ClassNotFoundException
  34.445 -    {
  34.446 -        if (curContext == null) {
  34.447 -            throw new NotActiveException("not in call to readObject");
  34.448 -        }
  34.449 -        Object curObj = null; // curContext.getObj();
  34.450 -        ObjectStreamClass curDesc = null; // curContext.getDesc();
  34.451 -        bin.setBlockDataMode(false);
  34.452 -        defaultReadFields(curObj, curDesc);
  34.453 -        bin.setBlockDataMode(true);
  34.454 -        if (!curDesc.hasWriteObjectData()) {
  34.455 -            /*
  34.456 -             * Fix for 4360508: since stream does not contain terminating
  34.457 -             * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere
  34.458 -             * knows to simulate end-of-custom-data behavior.
  34.459 -             */
  34.460 -            defaultDataEnd = true;
  34.461 -        }
  34.462 -        ClassNotFoundException ex = handles.lookupException(passHandle);
  34.463 -        if (ex != null) {
  34.464 -            throw ex;
  34.465 -        }
  34.466 -    }
  34.467 -
  34.468 -    /**
  34.469 -     * Reads the persistent fields from the stream and makes them available by
  34.470 -     * name.
  34.471 -     *
  34.472 -     * @return  the <code>GetField</code> object representing the persistent
  34.473 -     *          fields of the object being deserialized
  34.474 -     * @throws  ClassNotFoundException if the class of a serialized object
  34.475 -     *          could not be found.
  34.476 -     * @throws  IOException if an I/O error occurs.
  34.477 -     * @throws  NotActiveException if the stream is not currently reading
  34.478 -     *          objects.
  34.479 -     * @since 1.2
  34.480 -     */
  34.481 -    public ObjectInputStream.GetField readFields()
  34.482 -        throws IOException, ClassNotFoundException
  34.483 -    {
  34.484 -        if (curContext == null) {
  34.485 -            throw new NotActiveException("not in call to readObject");
  34.486 -        }
  34.487 -        Object curObj = null; // curContext.getObj();
  34.488 -        ObjectStreamClass curDesc = null; // curContext.getDesc();
  34.489 -        bin.setBlockDataMode(false);
  34.490 -        GetFieldImpl getField = new GetFieldImpl(curDesc);
  34.491 -        getField.readFields();
  34.492 -        bin.setBlockDataMode(true);
  34.493 -        if (!curDesc.hasWriteObjectData()) {
  34.494 -            /*
  34.495 -             * Fix for 4360508: since stream does not contain terminating
  34.496 -             * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere
  34.497 -             * knows to simulate end-of-custom-data behavior.
  34.498 -             */
  34.499 -            defaultDataEnd = true;
  34.500 -        }
  34.501 -
  34.502 -        return getField;
  34.503 -    }
  34.504 -
  34.505 -    /**
  34.506 -     * Register an object to be validated before the graph is returned.  While
  34.507 -     * similar to resolveObject these validations are called after the entire
  34.508 -     * graph has been reconstituted.  Typically, a readObject method will
  34.509 -     * register the object with the stream so that when all of the objects are
  34.510 -     * restored a final set of validations can be performed.
  34.511 -     *
  34.512 -     * @param   obj the object to receive the validation callback.
  34.513 -     * @param   prio controls the order of callbacks;zero is a good default.
  34.514 -     *          Use higher numbers to be called back earlier, lower numbers for
  34.515 -     *          later callbacks. Within a priority, callbacks are processed in
  34.516 -     *          no particular order.
  34.517 -     * @throws  NotActiveException The stream is not currently reading objects
  34.518 -     *          so it is invalid to register a callback.
  34.519 -     * @throws  InvalidObjectException The validation object is null.
  34.520 -     */
  34.521 -    public void registerValidation(ObjectInputValidation obj, int prio)
  34.522 -        throws NotActiveException, InvalidObjectException
  34.523 -    {
  34.524 -        if (depth == 0) {
  34.525 -            throw new NotActiveException("stream inactive");
  34.526 -        }
  34.527 -        vlist.register(obj, prio);
  34.528 -    }
  34.529 -
  34.530 -    /**
  34.531 -     * Load the local class equivalent of the specified stream class
  34.532 -     * description.  Subclasses may implement this method to allow classes to
  34.533 -     * be fetched from an alternate source.
  34.534 -     *
  34.535 -     * <p>The corresponding method in <code>ObjectOutputStream</code> is
  34.536 -     * <code>annotateClass</code>.  This method will be invoked only once for
  34.537 -     * each unique class in the stream.  This method can be implemented by
  34.538 -     * subclasses to use an alternate loading mechanism but must return a
  34.539 -     * <code>Class</code> object. Once returned, if the class is not an array
  34.540 -     * class, its serialVersionUID is compared to the serialVersionUID of the
  34.541 -     * serialized class, and if there is a mismatch, the deserialization fails
  34.542 -     * and an {@link InvalidClassException} is thrown.
  34.543 -     *
  34.544 -     * <p>The default implementation of this method in
  34.545 -     * <code>ObjectInputStream</code> returns the result of calling
  34.546 -     * <pre>
  34.547 -     *     Class.forName(desc.getName(), false, loader)
  34.548 -     * </pre>
  34.549 -     * where <code>loader</code> is determined as follows: if there is a
  34.550 -     * method on the current thread's stack whose declaring class was
  34.551 -     * defined by a user-defined class loader (and was not a generated to
  34.552 -     * implement reflective invocations), then <code>loader</code> is class
  34.553 -     * loader corresponding to the closest such method to the currently
  34.554 -     * executing frame; otherwise, <code>loader</code> is
  34.555 -     * <code>null</code>. If this call results in a
  34.556 -     * <code>ClassNotFoundException</code> and the name of the passed
  34.557 -     * <code>ObjectStreamClass</code> instance is the Java language keyword
  34.558 -     * for a primitive type or void, then the <code>Class</code> object
  34.559 -     * representing that primitive type or void will be returned
  34.560 -     * (e.g., an <code>ObjectStreamClass</code> with the name
  34.561 -     * <code>"int"</code> will be resolved to <code>Integer.TYPE</code>).
  34.562 -     * Otherwise, the <code>ClassNotFoundException</code> will be thrown to
  34.563 -     * the caller of this method.
  34.564 -     *
  34.565 -     * @param   desc an instance of class <code>ObjectStreamClass</code>
  34.566 -     * @return  a <code>Class</code> object corresponding to <code>desc</code>
  34.567 -     * @throws  IOException any of the usual Input/Output exceptions.
  34.568 -     * @throws  ClassNotFoundException if class of a serialized object cannot
  34.569 -     *          be found.
  34.570 -     */
  34.571 -    protected Class<?> resolveClass(ObjectStreamClass desc)
  34.572 -        throws IOException, ClassNotFoundException
  34.573 -    {
  34.574 -        String name = desc.getName();
  34.575 -        try {
  34.576 -            return Class.forName(name, false, latestUserDefinedLoader());
  34.577 -        } catch (ClassNotFoundException ex) {
  34.578 -            Class<?> cl = primClasses.get(name);
  34.579 -            if (cl != null) {
  34.580 -                return cl;
  34.581 -            } else {
  34.582 -                throw ex;
  34.583 -            }
  34.584 -        }
  34.585 -    }
  34.586 -
  34.587 -    /**
  34.588 -     * Returns a proxy class that implements the interfaces named in a proxy
  34.589 -     * class descriptor; subclasses may implement this method to read custom
  34.590 -     * data from the stream along with the descriptors for dynamic proxy
  34.591 -     * classes, allowing them to use an alternate loading mechanism for the
  34.592 -     * interfaces and the proxy class.
  34.593 -     *
  34.594 -     * <p>This method is called exactly once for each unique proxy class
  34.595 -     * descriptor in the stream.
  34.596 -     *
  34.597 -     * <p>The corresponding method in <code>ObjectOutputStream</code> is
  34.598 -     * <code>annotateProxyClass</code>.  For a given subclass of
  34.599 -     * <code>ObjectInputStream</code> that overrides this method, the
  34.600 -     * <code>annotateProxyClass</code> method in the corresponding subclass of
  34.601 -     * <code>ObjectOutputStream</code> must write any data or objects read by
  34.602 -     * this method.
  34.603 -     *
  34.604 -     * <p>The default implementation of this method in
  34.605 -     * <code>ObjectInputStream</code> returns the result of calling
  34.606 -     * <code>Proxy.getProxyClass</code> with the list of <code>Class</code>
  34.607 -     * objects for the interfaces that are named in the <code>interfaces</code>
  34.608 -     * parameter.  The <code>Class</code> object for each interface name
  34.609 -     * <code>i</code> is the value returned by calling
  34.610 -     * <pre>
  34.611 -     *     Class.forName(i, false, loader)
  34.612 -     * </pre>
  34.613 -     * where <code>loader</code> is that of the first non-<code>null</code>
  34.614 -     * class loader up the execution stack, or <code>null</code> if no
  34.615 -     * non-<code>null</code> class loaders are on the stack (the same class
  34.616 -     * loader choice used by the <code>resolveClass</code> method).  Unless any
  34.617 -     * of the resolved interfaces are non-public, this same value of
  34.618 -     * <code>loader</code> is also the class loader passed to
  34.619 -     * <code>Proxy.getProxyClass</code>; if non-public interfaces are present,
  34.620 -     * their class loader is passed instead (if more than one non-public
  34.621 -     * interface class loader is encountered, an
  34.622 -     * <code>IllegalAccessError</code> is thrown).
  34.623 -     * If <code>Proxy.getProxyClass</code> throws an
  34.624 -     * <code>IllegalArgumentException</code>, <code>resolveProxyClass</code>
  34.625 -     * will throw a <code>ClassNotFoundException</code> containing the
  34.626 -     * <code>IllegalArgumentException</code>.
  34.627 -     *
  34.628 -     * @param interfaces the list of interface names that were
  34.629 -     *                deserialized in the proxy class descriptor
  34.630 -     * @return  a proxy class for the specified interfaces
  34.631 -     * @throws        IOException any exception thrown by the underlying
  34.632 -     *                <code>InputStream</code>
  34.633 -     * @throws        ClassNotFoundException if the proxy class or any of the
  34.634 -     *                named interfaces could not be found
  34.635 -     * @see ObjectOutputStream#annotateProxyClass(Class)
  34.636 -     * @since 1.3
  34.637 -     */
  34.638 -    protected Class<?> resolveProxyClass(String[] interfaces)
  34.639 -        throws IOException, ClassNotFoundException
  34.640 -    {
  34.641 -        ClassLoader latestLoader = latestUserDefinedLoader();
  34.642 -        ClassLoader nonPublicLoader = null;
  34.643 -        boolean hasNonPublicInterface = false;
  34.644 -
  34.645 -        // define proxy in class loader of non-public interface(s), if any
  34.646 -        Class[] classObjs = new Class[interfaces.length];
  34.647 -        for (int i = 0; i < interfaces.length; i++) {
  34.648 -            Class cl = Class.forName(interfaces[i], false, latestLoader);
  34.649 -            if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
  34.650 -                if (hasNonPublicInterface) {
  34.651 -                    if (nonPublicLoader != cl.getClassLoader()) {
  34.652 -                        throw new IllegalAccessError(
  34.653 -                            "conflicting non-public interface class loaders");
  34.654 -                    }
  34.655 -                } else {
  34.656 -                    nonPublicLoader = cl.getClassLoader();
  34.657 -                    hasNonPublicInterface = true;
  34.658 -                }
  34.659 -            }
  34.660 -            classObjs[i] = cl;
  34.661 -        }
  34.662 -        try {
  34.663 -            return Proxy.getProxyClass(
  34.664 -                hasNonPublicInterface ? nonPublicLoader : latestLoader,
  34.665 -                classObjs);
  34.666 -        } catch (IllegalArgumentException e) {
  34.667 -            throw new ClassNotFoundException(null, e);
  34.668 -        }
  34.669 -    }
  34.670 -
  34.671 -    /**
  34.672 -     * This method will allow trusted subclasses of ObjectInputStream to
  34.673 -     * substitute one object for another during deserialization. Replacing
  34.674 -     * objects is disabled until enableResolveObject is called. The
  34.675 -     * enableResolveObject method checks that the stream requesting to resolve
  34.676 -     * object can be trusted. Every reference to serializable objects is passed
  34.677 -     * to resolveObject.  To insure that the private state of objects is not
  34.678 -     * unintentionally exposed only trusted streams may use resolveObject.
  34.679 -     *
  34.680 -     * <p>This method is called after an object has been read but before it is
  34.681 -     * returned from readObject.  The default resolveObject method just returns
  34.682 -     * the same object.
  34.683 -     *
  34.684 -     * <p>When a subclass is replacing objects it must insure that the
  34.685 -     * substituted object is compatible with every field where the reference
  34.686 -     * will be stored.  Objects whose type is not a subclass of the type of the
  34.687 -     * field or array element abort the serialization by raising an exception
  34.688 -     * and the object is not be stored.
  34.689 -     *
  34.690 -     * <p>This method is called only once when each object is first
  34.691 -     * encountered.  All subsequent references to the object will be redirected
  34.692 -     * to the new object.
  34.693 -     *
  34.694 -     * @param   obj object to be substituted
  34.695 -     * @return  the substituted object
  34.696 -     * @throws  IOException Any of the usual Input/Output exceptions.
  34.697 -     */
  34.698 -    protected Object resolveObject(Object obj) throws IOException {
  34.699 -        return obj;
  34.700 -    }
  34.701 -
  34.702 -    /**
  34.703 -     * Enable the stream to allow objects read from the stream to be replaced.
  34.704 -     * When enabled, the resolveObject method is called for every object being
  34.705 -     * deserialized.
  34.706 -     *
  34.707 -     * <p>If <i>enable</i> is true, and there is a security manager installed,
  34.708 -     * this method first calls the security manager's
  34.709 -     * <code>checkPermission</code> method with the
  34.710 -     * <code>SerializablePermission("enableSubstitution")</code> permission to
  34.711 -     * ensure it's ok to enable the stream to allow objects read from the
  34.712 -     * stream to be replaced.
  34.713 -     *
  34.714 -     * @param   enable true for enabling use of <code>resolveObject</code> for
  34.715 -     *          every object being deserialized
  34.716 -     * @return  the previous setting before this method was invoked
  34.717 -     * @throws  SecurityException if a security manager exists and its
  34.718 -     *          <code>checkPermission</code> method denies enabling the stream
  34.719 -     *          to allow objects read from the stream to be replaced.
  34.720 -     * @see SecurityManager#checkPermission
  34.721 -     * @see java.io.SerializablePermission
  34.722 -     */
  34.723 -    protected boolean enableResolveObject(boolean enable)
  34.724 -        throws SecurityException
  34.725 -    {
  34.726 -        throw new SecurityException();
  34.727 -    }
  34.728 -
  34.729 -    /**
  34.730 -     * The readStreamHeader method is provided to allow subclasses to read and
  34.731 -     * verify their own stream headers. It reads and verifies the magic number
  34.732 -     * and version number.
  34.733 -     *
  34.734 -     * @throws  IOException if there are I/O errors while reading from the
  34.735 -     *          underlying <code>InputStream</code>
  34.736 -     * @throws  StreamCorruptedException if control information in the stream
  34.737 -     *          is inconsistent
  34.738 -     */
  34.739 -    protected void readStreamHeader()
  34.740 -        throws IOException, StreamCorruptedException
  34.741 -    {
  34.742 -        short s0 = bin.readShort();
  34.743 -        short s1 = bin.readShort();
  34.744 -        if (s0 != STREAM_MAGIC || s1 != STREAM_VERSION) {
  34.745 -            throw new StreamCorruptedException(
  34.746 -                String.format("invalid stream header: %04X%04X", s0, s1));
  34.747 -        }
  34.748 -    }
  34.749 -
  34.750 -    /**
  34.751 -     * Read a class descriptor from the serialization stream.  This method is
  34.752 -     * called when the ObjectInputStream expects a class descriptor as the next
  34.753 -     * item in the serialization stream.  Subclasses of ObjectInputStream may
  34.754 -     * override this method to read in class descriptors that have been written
  34.755 -     * in non-standard formats (by subclasses of ObjectOutputStream which have
  34.756 -     * overridden the <code>writeClassDescriptor</code> method).  By default,
  34.757 -     * this method reads class descriptors according to the format defined in
  34.758 -     * the Object Serialization specification.
  34.759 -     *
  34.760 -     * @return  the class descriptor read
  34.761 -     * @throws  IOException If an I/O error has occurred.
  34.762 -     * @throws  ClassNotFoundException If the Class of a serialized object used
  34.763 -     *          in the class descriptor representation cannot be found
  34.764 -     * @see java.io.ObjectOutputStream#writeClassDescriptor(java.io.ObjectStreamClass)
  34.765 -     * @since 1.3
  34.766 -     */
  34.767 -    protected ObjectStreamClass readClassDescriptor()
  34.768 -        throws IOException, ClassNotFoundException
  34.769 -    {
  34.770 -        ObjectStreamClass desc = new ObjectStreamClass();
  34.771 -        desc.readNonProxy(this);
  34.772 -        return desc;
  34.773 -    }
  34.774 -
  34.775 -    /**
  34.776 -     * Reads a byte of data. This method will block if no input is available.
  34.777 -     *
  34.778 -     * @return  the byte read, or -1 if the end of the stream is reached.
  34.779 -     * @throws  IOException If an I/O error has occurred.
  34.780 -     */
  34.781 -    public int read() throws IOException {
  34.782 -        return bin.read();
  34.783 -    }
  34.784 -
  34.785 -    /**
  34.786 -     * Reads into an array of bytes.  This method will block until some input
  34.787 -     * is available. Consider using java.io.DataInputStream.readFully to read
  34.788 -     * exactly 'length' bytes.
  34.789 -     *
  34.790 -     * @param   buf the buffer into which the data is read
  34.791 -     * @param   off the start offset of the data
  34.792 -     * @param   len the maximum number of bytes read
  34.793 -     * @return  the actual number of bytes read, -1 is returned when the end of
  34.794 -     *          the stream is reached.
  34.795 -     * @throws  IOException If an I/O error has occurred.
  34.796 -     * @see java.io.DataInputStream#readFully(byte[],int,int)
  34.797 -     */
  34.798 -    public int read(byte[] buf, int off, int len) throws IOException {
  34.799 -        if (buf == null) {
  34.800 -            throw new NullPointerException();
  34.801 -        }
  34.802 -        int endoff = off + len;
  34.803 -        if (off < 0 || len < 0 || endoff > buf.length || endoff < 0) {
  34.804 -            throw new IndexOutOfBoundsException();
  34.805 -        }
  34.806 -        return bin.read(buf, off, len, false);
  34.807 -    }
  34.808 -
  34.809 -    /**
  34.810 -     * Returns the number of bytes that can be read without blocking.
  34.811 -     *
  34.812 -     * @return  the number of available bytes.
  34.813 -     * @throws  IOException if there are I/O errors while reading from the
  34.814 -     *          underlying <code>InputStream</code>
  34.815 -     */
  34.816 -    public int available() throws IOException {
  34.817 -        return bin.available();
  34.818 -    }
  34.819 -
  34.820 -    /**
  34.821 -     * Closes the input stream. Must be called to release any resources
  34.822 -     * associated with the stream.
  34.823 -     *
  34.824 -     * @throws  IOException If an I/O error has occurred.
  34.825 -     */
  34.826 -    public void close() throws IOException {
  34.827 -        /*
  34.828 -         * Even if stream already closed, propagate redundant close to
  34.829 -         * underlying stream to stay consistent with previous implementations.
  34.830 -         */
  34.831 -        closed = true;
  34.832 -        if (depth == 0) {
  34.833 -            clear();
  34.834 -        }
  34.835 -        bin.close();
  34.836 -    }
  34.837 -
  34.838 -    /**
  34.839 -     * Reads in a boolean.
  34.840 -     *
  34.841 -     * @return  the boolean read.
  34.842 -     * @throws  EOFException If end of file is reached.
  34.843 -     * @throws  IOException If other I/O error has occurred.
  34.844 -     */
  34.845 -    public boolean readBoolean() throws IOException {
  34.846 -        return bin.readBoolean();
  34.847 -    }
  34.848 -
  34.849 -    /**
  34.850 -     * Reads an 8 bit byte.
  34.851 -     *
  34.852 -     * @return  the 8 bit byte read.
  34.853 -     * @throws  EOFException If end of file is reached.
  34.854 -     * @throws  IOException If other I/O error has occurred.
  34.855 -     */
  34.856 -    public byte readByte() throws IOException  {
  34.857 -        return bin.readByte();
  34.858 -    }
  34.859 -
  34.860 -    /**
  34.861 -     * Reads an unsigned 8 bit byte.
  34.862 -     *
  34.863 -     * @return  the 8 bit byte read.
  34.864 -     * @throws  EOFException If end of file is reached.
  34.865 -     * @throws  IOException If other I/O error has occurred.
  34.866 -     */
  34.867 -    public int readUnsignedByte()  throws IOException {
  34.868 -        return bin.readUnsignedByte();
  34.869 -    }
  34.870 -
  34.871 -    /**
  34.872 -     * Reads a 16 bit char.
  34.873 -     *
  34.874 -     * @return  the 16 bit char read.
  34.875 -     * @throws  EOFException If end of file is reached.
  34.876 -     * @throws  IOException If other I/O error has occurred.
  34.877 -     */
  34.878 -    public char readChar()  throws IOException {
  34.879 -        return bin.readChar();
  34.880 -    }
  34.881 -
  34.882 -    /**
  34.883 -     * Reads a 16 bit short.
  34.884 -     *
  34.885 -     * @return  the 16 bit short read.
  34.886 -     * @throws  EOFException If end of file is reached.
  34.887 -     * @throws  IOException If other I/O error has occurred.
  34.888 -     */
  34.889 -    public short readShort()  throws IOException {
  34.890 -        return bin.readShort();
  34.891 -    }
  34.892 -
  34.893 -    /**
  34.894 -     * Reads an unsigned 16 bit short.
  34.895 -     *
  34.896 -     * @return  the 16 bit short read.
  34.897 -     * @throws  EOFException If end of file is reached.
  34.898 -     * @throws  IOException If other I/O error has occurred.
  34.899 -     */
  34.900 -    public int readUnsignedShort() throws IOException {
  34.901 -        return bin.readUnsignedShort();
  34.902 -    }
  34.903 -
  34.904 -    /**
  34.905 -     * Reads a 32 bit int.
  34.906 -     *
  34.907 -     * @return  the 32 bit integer read.
  34.908 -     * @throws  EOFException If end of file is reached.
  34.909 -     * @throws  IOException If other I/O error has occurred.
  34.910 -     */
  34.911 -    public int readInt()  throws IOException {
  34.912 -        return bin.readInt();
  34.913 -    }
  34.914 -
  34.915 -    /**
  34.916 -     * Reads a 64 bit long.
  34.917 -     *
  34.918 -     * @return  the read 64 bit long.
  34.919 -     * @throws  EOFException If end of file is reached.
  34.920 -     * @throws  IOException If other I/O error has occurred.
  34.921 -     */
  34.922 -    public long readLong()  throws IOException {
  34.923 -        return bin.readLong();
  34.924 -    }
  34.925 -
  34.926 -    /**
  34.927 -     * Reads a 32 bit float.
  34.928 -     *
  34.929 -     * @return  the 32 bit float read.
  34.930 -     * @throws  EOFException If end of file is reached.
  34.931 -     * @throws  IOException If other I/O error has occurred.
  34.932 -     */
  34.933 -    public float readFloat() throws IOException {
  34.934 -        return bin.readFloat();
  34.935 -    }
  34.936 -
  34.937 -    /**
  34.938 -     * Reads a 64 bit double.
  34.939 -     *
  34.940 -     * @return  the 64 bit double read.
  34.941 -     * @throws  EOFException If end of file is reached.
  34.942 -     * @throws  IOException If other I/O error has occurred.
  34.943 -     */
  34.944 -    public double readDouble() throws IOException {
  34.945 -        return bin.readDouble();
  34.946 -    }
  34.947 -
  34.948 -    /**
  34.949 -     * Reads bytes, blocking until all bytes are read.
  34.950 -     *
  34.951 -     * @param   buf the buffer into which the data is read
  34.952 -     * @throws  EOFException If end of file is reached.
  34.953 -     * @throws  IOException If other I/O error has occurred.
  34.954 -     */
  34.955 -    public void readFully(byte[] buf) throws IOException {
  34.956 -        bin.readFully(buf, 0, buf.length, false);
  34.957 -    }
  34.958 -
  34.959 -    /**
  34.960 -     * Reads bytes, blocking until all bytes are read.
  34.961 -     *
  34.962 -     * @param   buf the buffer into which the data is read
  34.963 -     * @param   off the start offset of the data
  34.964 -     * @param   len the maximum number of bytes to read
  34.965 -     * @throws  EOFException If end of file is reached.
  34.966 -     * @throws  IOException If other I/O error has occurred.
  34.967 -     */
  34.968 -    public void readFully(byte[] buf, int off, int len) throws IOException {
  34.969 -        int endoff = off + len;
  34.970 -        if (off < 0 || len < 0 || endoff > buf.length || endoff < 0) {
  34.971 -            throw new IndexOutOfBoundsException();
  34.972 -        }
  34.973 -        bin.readFully(buf, off, len, false);
  34.974 -    }
  34.975 -
  34.976 -    /**
  34.977 -     * Skips bytes.
  34.978 -     *
  34.979 -     * @param   len the number of bytes to be skipped
  34.980 -     * @return  the actual number of bytes skipped.
  34.981 -     * @throws  IOException If an I/O error has occurred.
  34.982 -     */
  34.983 -    public int skipBytes(int len) throws IOException {
  34.984 -        return bin.skipBytes(len);
  34.985 -    }
  34.986 -
  34.987 -    /**
  34.988 -     * Reads in a line that has been terminated by a \n, \r, \r\n or EOF.
  34.989 -     *
  34.990 -     * @return  a String copy of the line.
  34.991 -     * @throws  IOException if there are I/O errors while reading from the
  34.992 -     *          underlying <code>InputStream</code>
  34.993 -     * @deprecated This method does not properly convert bytes to characters.
  34.994 -     *          see DataInputStream for the details and alternatives.
  34.995 -     */
  34.996 -    @Deprecated
  34.997 -    public String readLine() throws IOException {
  34.998 -        return bin.readLine();
  34.999 -    }
 34.1000 -
 34.1001 -    /**
 34.1002 -     * Reads a String in
 34.1003 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
 34.1004 -     * format.
 34.1005 -     *
 34.1006 -     * @return  the String.
 34.1007 -     * @throws  IOException if there are I/O errors while reading from the
 34.1008 -     *          underlying <code>InputStream</code>
 34.1009 -     * @throws  UTFDataFormatException if read bytes do not represent a valid
 34.1010 -     *          modified UTF-8 encoding of a string
 34.1011 -     */
 34.1012 -    public String readUTF() throws IOException {
 34.1013 -        return bin.readUTF();
 34.1014 -    }
 34.1015 -
 34.1016 -    /**
 34.1017 -     * Provide access to the persistent fields read from the input stream.
 34.1018 -     */
 34.1019 -    public static abstract class GetField {
 34.1020 -
 34.1021 -        /**
 34.1022 -         * Get the ObjectStreamClass that describes the fields in the stream.
 34.1023 -         *
 34.1024 -         * @return  the descriptor class that describes the serializable fields
 34.1025 -         */
 34.1026 -        public abstract ObjectStreamClass getObjectStreamClass();
 34.1027 -
 34.1028 -        /**
 34.1029 -         * Return true if the named field is defaulted and has no value in this
 34.1030 -         * stream.
 34.1031 -         *
 34.1032 -         * @param  name the name of the field
 34.1033 -         * @return true, if and only if the named field is defaulted
 34.1034 -         * @throws IOException if there are I/O errors while reading from
 34.1035 -         *         the underlying <code>InputStream</code>
 34.1036 -         * @throws IllegalArgumentException if <code>name</code> does not
 34.1037 -         *         correspond to a serializable field
 34.1038 -         */
 34.1039 -        public abstract boolean defaulted(String name) throws IOException;
 34.1040 -
 34.1041 -        /**
 34.1042 -         * Get the value of the named boolean field from the persistent field.
 34.1043 -         *
 34.1044 -         * @param  name the name of the field
 34.1045 -         * @param  val the default value to use if <code>name</code> does not
 34.1046 -         *         have a value
 34.1047 -         * @return the value of the named <code>boolean</code> field
 34.1048 -         * @throws IOException if there are I/O errors while reading from the
 34.1049 -         *         underlying <code>InputStream</code>
 34.1050 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1051 -         *         not serializable or if the field type is incorrect
 34.1052 -         */
 34.1053 -        public abstract boolean get(String name, boolean val)
 34.1054 -            throws IOException;
 34.1055 -
 34.1056 -        /**
 34.1057 -         * Get the value of the named byte field from the persistent field.
 34.1058 -         *
 34.1059 -         * @param  name the name of the field
 34.1060 -         * @param  val the default value to use if <code>name</code> does not
 34.1061 -         *         have a value
 34.1062 -         * @return the value of the named <code>byte</code> field
 34.1063 -         * @throws IOException if there are I/O errors while reading from the
 34.1064 -         *         underlying <code>InputStream</code>
 34.1065 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1066 -         *         not serializable or if the field type is incorrect
 34.1067 -         */
 34.1068 -        public abstract byte get(String name, byte val) throws IOException;
 34.1069 -
 34.1070 -        /**
 34.1071 -         * Get the value of the named char field from the persistent field.
 34.1072 -         *
 34.1073 -         * @param  name the name of the field
 34.1074 -         * @param  val the default value to use if <code>name</code> does not
 34.1075 -         *         have a value
 34.1076 -         * @return the value of the named <code>char</code> field
 34.1077 -         * @throws IOException if there are I/O errors while reading from the
 34.1078 -         *         underlying <code>InputStream</code>
 34.1079 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1080 -         *         not serializable or if the field type is incorrect
 34.1081 -         */
 34.1082 -        public abstract char get(String name, char val) throws IOException;
 34.1083 -
 34.1084 -        /**
 34.1085 -         * Get the value of the named short field from the persistent field.
 34.1086 -         *
 34.1087 -         * @param  name the name of the field
 34.1088 -         * @param  val the default value to use if <code>name</code> does not
 34.1089 -         *         have a value
 34.1090 -         * @return the value of the named <code>short</code> field
 34.1091 -         * @throws IOException if there are I/O errors while reading from the
 34.1092 -         *         underlying <code>InputStream</code>
 34.1093 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1094 -         *         not serializable or if the field type is incorrect
 34.1095 -         */
 34.1096 -        public abstract short get(String name, short val) throws IOException;
 34.1097 -
 34.1098 -        /**
 34.1099 -         * Get the value of the named int field from the persistent field.
 34.1100 -         *
 34.1101 -         * @param  name the name of the field
 34.1102 -         * @param  val the default value to use if <code>name</code> does not
 34.1103 -         *         have a value
 34.1104 -         * @return the value of the named <code>int</code> field
 34.1105 -         * @throws IOException if there are I/O errors while reading from the
 34.1106 -         *         underlying <code>InputStream</code>
 34.1107 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1108 -         *         not serializable or if the field type is incorrect
 34.1109 -         */
 34.1110 -        public abstract int get(String name, int val) throws IOException;
 34.1111 -
 34.1112 -        /**
 34.1113 -         * Get the value of the named long field from the persistent field.
 34.1114 -         *
 34.1115 -         * @param  name the name of the field
 34.1116 -         * @param  val the default value to use if <code>name</code> does not
 34.1117 -         *         have a value
 34.1118 -         * @return the value of the named <code>long</code> field
 34.1119 -         * @throws IOException if there are I/O errors while reading from the
 34.1120 -         *         underlying <code>InputStream</code>
 34.1121 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1122 -         *         not serializable or if the field type is incorrect
 34.1123 -         */
 34.1124 -        public abstract long get(String name, long val) throws IOException;
 34.1125 -
 34.1126 -        /**
 34.1127 -         * Get the value of the named float field from the persistent field.
 34.1128 -         *
 34.1129 -         * @param  name the name of the field
 34.1130 -         * @param  val the default value to use if <code>name</code> does not
 34.1131 -         *         have a value
 34.1132 -         * @return the value of the named <code>float</code> field
 34.1133 -         * @throws IOException if there are I/O errors while reading from the
 34.1134 -         *         underlying <code>InputStream</code>
 34.1135 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1136 -         *         not serializable or if the field type is incorrect
 34.1137 -         */
 34.1138 -        public abstract float get(String name, float val) throws IOException;
 34.1139 -
 34.1140 -        /**
 34.1141 -         * Get the value of the named double field from the persistent field.
 34.1142 -         *
 34.1143 -         * @param  name the name of the field
 34.1144 -         * @param  val the default value to use if <code>name</code> does not
 34.1145 -         *         have a value
 34.1146 -         * @return the value of the named <code>double</code> field
 34.1147 -         * @throws IOException if there are I/O errors while reading from the
 34.1148 -         *         underlying <code>InputStream</code>
 34.1149 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1150 -         *         not serializable or if the field type is incorrect
 34.1151 -         */
 34.1152 -        public abstract double get(String name, double val) throws IOException;
 34.1153 -
 34.1154 -        /**
 34.1155 -         * Get the value of the named Object field from the persistent field.
 34.1156 -         *
 34.1157 -         * @param  name the name of the field
 34.1158 -         * @param  val the default value to use if <code>name</code> does not
 34.1159 -         *         have a value
 34.1160 -         * @return the value of the named <code>Object</code> field
 34.1161 -         * @throws IOException if there are I/O errors while reading from the
 34.1162 -         *         underlying <code>InputStream</code>
 34.1163 -         * @throws IllegalArgumentException if type of <code>name</code> is
 34.1164 -         *         not serializable or if the field type is incorrect
 34.1165 -         */
 34.1166 -        public abstract Object get(String name, Object val) throws IOException;
 34.1167 -    }
 34.1168 -
 34.1169 -    /**
 34.1170 -     * Verifies that this (possibly subclass) instance can be constructed
 34.1171 -     * without violating security constraints: the subclass must not override
 34.1172 -     * security-sensitive non-final methods, or else the
 34.1173 -     * "enableSubclassImplementation" SerializablePermission is checked.
 34.1174 -     */
 34.1175 -    private void verifySubclass() {
 34.1176 -        Class cl = getClass();
 34.1177 -        if (cl == ObjectInputStream.class) {
 34.1178 -            return;
 34.1179 -        }
 34.1180 -        throw new SecurityException();
 34.1181 -    }
 34.1182 -
 34.1183 -    /**
 34.1184 -     * Clears internal data structures.
 34.1185 -     */
 34.1186 -    private void clear() {
 34.1187 -        handles.clear();
 34.1188 -        vlist.clear();
 34.1189 -    }
 34.1190 -
 34.1191 -    /**
 34.1192 -     * Underlying readObject implementation.
 34.1193 -     */
 34.1194 -    private Object readObject0(boolean unshared) throws IOException {
 34.1195 -        boolean oldMode = bin.getBlockDataMode();
 34.1196 -        if (oldMode) {
 34.1197 -            int remain = bin.currentBlockRemaining();
 34.1198 -            if (remain > 0) {
 34.1199 -                throw new OptionalDataException(remain);
 34.1200 -            } else if (defaultDataEnd) {
 34.1201 -                /*
 34.1202 -                 * Fix for 4360508: stream is currently at the end of a field
 34.1203 -                 * value block written via default serialization; since there
 34.1204 -                 * is no terminating TC_ENDBLOCKDATA tag, simulate
 34.1205 -                 * end-of-custom-data behavior explicitly.
 34.1206 -                 */
 34.1207 -                throw new OptionalDataException(true);
 34.1208 -            }
 34.1209 -            bin.setBlockDataMode(false);
 34.1210 -        }
 34.1211 -
 34.1212 -        byte tc;
 34.1213 -        while ((tc = bin.peekByte()) == TC_RESET) {
 34.1214 -            bin.readByte();
 34.1215 -            handleReset();
 34.1216 -        }
 34.1217 -
 34.1218 -        depth++;
 34.1219 -        try {
 34.1220 -            switch (tc) {
 34.1221 -                case TC_NULL:
 34.1222 -                    return readNull();
 34.1223 -
 34.1224 -                case TC_REFERENCE:
 34.1225 -                    return readHandle(unshared);
 34.1226 -
 34.1227 -                case TC_CLASS:
 34.1228 -                    return readClass(unshared);
 34.1229 -
 34.1230 -                case TC_CLASSDESC:
 34.1231 -                case TC_PROXYCLASSDESC:
 34.1232 -                    return readClassDesc(unshared);
 34.1233 -
 34.1234 -                case TC_STRING: