Need to merge in default branch: It contains automatic conversion of boxed types to primitive values which is needed by Knockout to display elements of arrays properly. model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 22 Mar 2013 17:03:32 +0100
branchmodel
changeset 878ecbd252fd3a7
parent 877 3392f250c784
parent 871 6168fb585ab4
child 879 af170d42b5b3
Need to merge in default branch: It contains automatic conversion of boxed types to primitive values which is needed by Knockout to display elements of arrays properly.
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
javaquery/api/pom.xml
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java
javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/demo/calc/Calc.java
javaquery/demo-calculator/src/main/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calc.java
javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calculator.xhtml
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
rt/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.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/.hgtags	Fri Mar 22 16:59:47 2013 +0100
     1.2 +++ b/.hgtags	Fri Mar 22 17:03:32 2013 +0100
     1.3 @@ -1,1 +1,3 @@
     1.4  0a115f1c6f3c70458fc479ae82b4d7fcdeb7e95a jdk7-b147_base
     1.5 +7367a296a9ec4a88e0292a41244c96283818e563 bck2brwsr-0.3
     1.6 +caf1e66268fd4100d57922d973ae09a6bf3be847 release-${releaseVersion}
     2.1 --- a/benchmarks/matrix-multiplication/pom.xml	Fri Mar 22 16:59:47 2013 +0100
     2.2 +++ b/benchmarks/matrix-multiplication/pom.xml	Fri Mar 22 17:03:32 2013 +0100
     2.3 @@ -1,16 +1,15 @@
     2.4  <?xml version="1.0"?>
     2.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     2.6 -  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     2.7 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     2.8    <modelVersion>4.0.0</modelVersion>
     2.9  
    2.10    <groupId>org.apidesign.bck2brwsr</groupId>
    2.11    <artifactId>matrix.multiplication</artifactId>
    2.12 -  <version>0.3-SNAPSHOT</version>
    2.13 +  <version>0.5-SNAPSHOT</version>
    2.14    <packaging>jar</packaging>
    2.15    <parent>
    2.16      <artifactId>benchmarks</artifactId>
    2.17      <groupId>org.apidesign.bck2brwsr</groupId>
    2.18 -    <version>0.3-SNAPSHOT</version>
    2.19 +    <version>0.5-SNAPSHOT</version>
    2.20    </parent>
    2.21  
    2.22    <name>Matrix multiplication</name>
    2.23 @@ -38,6 +37,36 @@
    2.24                    <skip>true</skip>
    2.25                </configuration>
    2.26            </plugin>      
    2.27 +          <plugin>
    2.28 +              <groupId>org.codehaus.mojo</groupId>
    2.29 +              <artifactId>xml-maven-plugin</artifactId>
    2.30 +              <version>1.0</version>
    2.31 +              <executions>
    2.32 +                  <execution>
    2.33 +                      <goals>
    2.34 +                          <goal>transform</goal>
    2.35 +                      </goals>
    2.36 +                      <phase>install</phase>
    2.37 +                  </execution>
    2.38 +              </executions>
    2.39 +              <configuration>
    2.40 +                  <transformationSets>
    2.41 +                      <transformationSet>
    2.42 +                          <dir>target/surefire-reports</dir>
    2.43 +                          <outputDir>target/surefire-reports</outputDir>
    2.44 +                          <includes>
    2.45 +                              <include>TEST*.xml</include>
    2.46 +                          </includes>
    2.47 +                          <stylesheet>src/main/select-time.xsl</stylesheet>
    2.48 +                          <fileMappers>
    2.49 +                              <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
    2.50 +                                  <targetExtension>.csv</targetExtension>
    2.51 +                              </fileMapper>
    2.52 +                          </fileMappers>                          
    2.53 +                      </transformationSet>
    2.54 +                  </transformationSets>
    2.55 +              </configuration>
    2.56 +          </plugin>
    2.57        </plugins>
    2.58    </build>
    2.59    
    2.60 @@ -45,7 +74,7 @@
    2.61      <dependency>
    2.62        <groupId>org.apidesign.bck2brwsr</groupId>
    2.63        <artifactId>emul.mini</artifactId>
    2.64 -      <version>0.3-SNAPSHOT</version>
    2.65 +      <version>0.5-SNAPSHOT</version>
    2.66      </dependency>
    2.67      <dependency>
    2.68        <groupId>org.testng</groupId>
    2.69 @@ -62,7 +91,7 @@
    2.70      <dependency>
    2.71        <groupId>org.apidesign.bck2brwsr</groupId>
    2.72        <artifactId>vmtest</artifactId>
    2.73 -      <version>0.3-SNAPSHOT</version>
    2.74 +      <version>0.5-SNAPSHOT</version>
    2.75        <scope>test</scope>
    2.76      </dependency>
    2.77    </dependencies>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/benchmarks/matrix-multiplication/src/main/select-time.xsl	Fri Mar 22 17:03:32 2013 +0100
     3.3 @@ -0,0 +1,55 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<!--
     3.6 +
     3.7 +    Back 2 Browser Bytecode Translator
     3.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.9 +
    3.10 +    This program is free software: you can redistribute it and/or modify
    3.11 +    it under the terms of the GNU General Public License as published by
    3.12 +    the Free Software Foundation, version 2 of the License.
    3.13 +
    3.14 +    This program is distributed in the hope that it will be useful,
    3.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.17 +    GNU General Public License for more details.
    3.18 +
    3.19 +    You should have received a copy of the GNU General Public License
    3.20 +    along with this program. Look for COPYING file in the top folder.
    3.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    3.22 +
    3.23 +-->
    3.24 +
    3.25 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    3.26 +    <xsl:output method="text"/>
    3.27 +
    3.28 +    <xsl:template match="/">
    3.29 +        <xsl:apply-templates mode="header" select="testsuite/testcase"/><xsl:text>End
    3.30 +</xsl:text>
    3.31 +        <xsl:apply-templates mode="value" select="testsuite/testcase"/><xsl:text>NaN
    3.32 +</xsl:text>
    3.33 +    </xsl:template>
    3.34 +        
    3.35 +    
    3.36 +    <xsl:template match="testcase" mode="header">
    3.37 +      <xsl:if test="contains(@name,'tenThousand')">
    3.38 +        <xsl:if test="not(contains(@name, '[Java]'))">
    3.39 +          <xsl:if test="not(contains(@name, '[Compare'))">
    3.40 +              <xsl:value-of select="@name"/>
    3.41 +              <xsl:text>,</xsl:text>
    3.42 +          </xsl:if>
    3.43 +        </xsl:if>
    3.44 +      </xsl:if>
    3.45 +    </xsl:template>
    3.46 +
    3.47 +    <xsl:template match="testcase" mode="value">
    3.48 +      <xsl:if test="contains(@name,'tenThousand')">
    3.49 +        <xsl:if test="not(contains(@name, '[Java]'))">
    3.50 +          <xsl:if test="not(contains(@name, '[Compare'))">
    3.51 +            <xsl:value-of select="@time"/>
    3.52 +            <xsl:text>,</xsl:text>
    3.53 +          </xsl:if>
    3.54 +        </xsl:if>
    3.55 +      </xsl:if>
    3.56 +    </xsl:template>
    3.57 +
    3.58 +</xsl:stylesheet>
     4.1 --- a/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Fri Mar 22 16:59:47 2013 +0100
     4.2 +++ b/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Fri Mar 22 17:03:32 2013 +0100
     4.3 @@ -31,6 +31,22 @@
     4.4      }
     4.5  
     4.6      @Compare(scripting = false) 
     4.7 +    public String oneIteration() throws IOException {
     4.8 +    
     4.9 +        Matrix m1 = new Matrix(5);
    4.10 +        Matrix m2 = new Matrix(5);
    4.11 +        
    4.12 +        m1.generateData();
    4.13 +        m2.generateData();
    4.14 +        
    4.15 +        Matrix res = m1.multiply(m2);
    4.16 +        
    4.17 +        StringBuilder sb = new StringBuilder();
    4.18 +        res.printOn(sb);
    4.19 +        return sb.toString();
    4.20 +    }
    4.21 +    
    4.22 +    @Compare(scripting = false) 
    4.23      public String tenThousandIterations() throws IOException {
    4.24      
    4.25          Matrix m1 = new Matrix(5);
    4.26 @@ -50,6 +66,27 @@
    4.27          return sb.toString();
    4.28      }
    4.29      
    4.30 +    @Compare(scripting = false) 
    4.31 +    public String tenUselessIterations() throws IOException {
    4.32 +    
    4.33 +        Matrix m1 = new Matrix(5);
    4.34 +        Matrix m2 = new Matrix(5);
    4.35 +        
    4.36 +        m1.generateData();
    4.37 +        m2.generateData();
    4.38 +        
    4.39 +        Matrix res = null;
    4.40 +        for (int i = 0; i < 10; i++) {
    4.41 +            res = m1.multiply(m2);
    4.42 +            m1 = res;
    4.43 +        }
    4.44 +        
    4.45 +        StringBuilder sb = new StringBuilder();
    4.46 +        res.printOn(sb);
    4.47 +        return sb.toString();
    4.48 +    }
    4.49 +
    4.50 +    
    4.51      @Factory
    4.52      public static Object[] create() {
    4.53          return VMTest.create(MatrixTest.class);
     5.1 --- a/benchmarks/pom.xml	Fri Mar 22 16:59:47 2013 +0100
     5.2 +++ b/benchmarks/pom.xml	Fri Mar 22 17:03:32 2013 +0100
     5.3 @@ -4,11 +4,11 @@
     5.4    <parent>
     5.5      <artifactId>bck2brwsr</artifactId>
     5.6      <groupId>org.apidesign</groupId>
     5.7 -    <version>0.3-SNAPSHOT</version>
     5.8 +    <version>0.5-SNAPSHOT</version>
     5.9    </parent>
    5.10    <groupId>org.apidesign.bck2brwsr</groupId>
    5.11    <artifactId>benchmarks</artifactId>
    5.12 -  <version>0.3-SNAPSHOT</version>
    5.13 +  <version>0.5-SNAPSHOT</version>
    5.14    <packaging>pom</packaging>
    5.15    <name>Performance benchmarks</name>
    5.16    <modules>
     6.1 --- a/core/pom.xml	Fri Mar 22 16:59:47 2013 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,46 +0,0 @@
     6.4 -<?xml version="1.0"?>
     6.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"
     6.6 -    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     6.7 -  <modelVersion>4.0.0</modelVersion>
     6.8 -  <parent>
     6.9 -    <groupId>org.apidesign</groupId>
    6.10 -    <artifactId>bck2brwsr</artifactId>
    6.11 -    <version>0.3-SNAPSHOT</version>
    6.12 -  </parent>
    6.13 -  <groupId>org.apidesign.bck2brwsr</groupId>
    6.14 -  <artifactId>core</artifactId>
    6.15 -  <version>0.3-SNAPSHOT</version>
    6.16 -  <name>Core JS Annotations</name>
    6.17 -  <url>http://maven.apache.org</url>
    6.18 -    <build>
    6.19 -        <plugins>
    6.20 -            <plugin>
    6.21 -                <groupId>org.apache.maven.plugins</groupId>
    6.22 -                <artifactId>maven-compiler-plugin</artifactId>
    6.23 -                <version>2.3.2</version>
    6.24 -                <configuration>
    6.25 -                    <source>1.7</source>
    6.26 -                    <target>1.7</target>
    6.27 -                </configuration>
    6.28 -            </plugin>
    6.29 -        </plugins>
    6.30 -    </build>
    6.31 -    <properties>
    6.32 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    6.33 -  </properties>
    6.34 -  <dependencies>
    6.35 -    <dependency>
    6.36 -      <groupId>junit</groupId>
    6.37 -      <artifactId>junit</artifactId>
    6.38 -      <version>3.8.1</version>
    6.39 -      <scope>test</scope>
    6.40 -    </dependency>
    6.41 -    <dependency>
    6.42 -      <groupId>org.netbeans.api</groupId>
    6.43 -      <artifactId>org-openide-util-lookup</artifactId>
    6.44 -      <scope>provided</scope>
    6.45 -    </dependency>
    6.46 -  </dependencies>
    6.47 -    <description>Contains esential annotations for associating JavaScript code with
    6.48 -methods and classes.</description>
    6.49 -</project>
     7.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java	Fri Mar 22 16:59:47 2013 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,36 +0,0 @@
     7.4 -/**
     7.5 - * Back 2 Browser Bytecode Translator
     7.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     7.7 - *
     7.8 - * This program is free software: you can redistribute it and/or modify
     7.9 - * it under the terms of the GNU General Public License as published by
    7.10 - * the Free Software Foundation, version 2 of the License.
    7.11 - *
    7.12 - * This program is distributed in the hope that it will be useful,
    7.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.15 - * GNU General Public License for more details.
    7.16 - *
    7.17 - * You should have received a copy of the GNU General Public License
    7.18 - * along with this program. Look for COPYING file in the top folder.
    7.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    7.20 - */
    7.21 -package org.apidesign.bck2brwsr.core;
    7.22 -
    7.23 -import java.lang.annotation.ElementType;
    7.24 -import java.lang.annotation.Retention;
    7.25 -import java.lang.annotation.RetentionPolicy;
    7.26 -import java.lang.annotation.Target;
    7.27 -
    7.28 -/**
    7.29 - *
    7.30 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    7.31 - */
    7.32 -@Retention(RetentionPolicy.CLASS)
    7.33 -@Target(ElementType.TYPE)
    7.34 -public @interface ExtraJavaScript {
    7.35 -    /** location of a script to load */
    7.36 -    String resource();
    7.37 -    /** should the class file still be processed or not? */
    7.38 -    boolean processByteCode() default true;
    7.39 -}
     8.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Fri Mar 22 16:59:47 2013 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,51 +0,0 @@
     8.4 -/**
     8.5 - * Back 2 Browser Bytecode Translator
     8.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     8.7 - *
     8.8 - * This program is free software: you can redistribute it and/or modify
     8.9 - * it under the terms of the GNU General Public License as published by
    8.10 - * the Free Software Foundation, version 2 of the License.
    8.11 - *
    8.12 - * This program is distributed in the hope that it will be useful,
    8.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.15 - * GNU General Public License for more details.
    8.16 - *
    8.17 - * You should have received a copy of the GNU General Public License
    8.18 - * along with this program. Look for COPYING file in the top folder.
    8.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    8.20 - */
    8.21 -package org.apidesign.bck2brwsr.core;
    8.22 -
    8.23 -import java.lang.annotation.ElementType;
    8.24 -import java.lang.annotation.Retention;
    8.25 -import java.lang.annotation.RetentionPolicy;
    8.26 -import java.lang.annotation.Target;
    8.27 -
    8.28 -/** Put this method on a method in case it should have a special
    8.29 - * body in the <em>JavaScript</em>.
    8.30 - *
    8.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    8.32 - */
    8.33 -@Retention(RetentionPolicy.CLASS)
    8.34 -@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR })
    8.35 -public @interface JavaScriptBody {
    8.36 -    /** Names of parameters for the method. 
    8.37 -     * 
    8.38 -     * <!--
    8.39 -     * If not specified
    8.40 -     * it will be <code>arg0, arg1, arg2</code>. In case of
    8.41 -     * instance methods, the <code>arg0</code> is reference
    8.42 -     * to <code>this</code>.
    8.43 -     * -->
    8.44 -     * 
    8.45 -     * @return array of the names of parameters for the method
    8.46 -     *    in JavaScript
    8.47 -     */
    8.48 -    public String[] args();
    8.49 -    
    8.50 -    /** The actual body of the method in JavaScript. This string will be
    8.51 -     * put into generated header (ends with '{') and footer (ends with '}').
    8.52 -     */
    8.53 -    public String body();
    8.54 -}
     9.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java	Fri Mar 22 16:59:47 2013 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,37 +0,0 @@
     9.4 -/**
     9.5 - * Back 2 Browser Bytecode Translator
     9.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     9.7 - *
     9.8 - * This program is free software: you can redistribute it and/or modify
     9.9 - * it under the terms of the GNU General Public License as published by
    9.10 - * the Free Software Foundation, version 2 of the License.
    9.11 - *
    9.12 - * This program is distributed in the hope that it will be useful,
    9.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.15 - * GNU General Public License for more details.
    9.16 - *
    9.17 - * You should have received a copy of the GNU General Public License
    9.18 - * along with this program. Look for COPYING file in the top folder.
    9.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    9.20 - */
    9.21 -package org.apidesign.bck2brwsr.core;
    9.22 -
    9.23 -import java.lang.annotation.ElementType;
    9.24 -import java.lang.annotation.Retention;
    9.25 -import java.lang.annotation.RetentionPolicy;
    9.26 -import java.lang.annotation.Target;
    9.27 -
    9.28 -/** Don't include given field or method in generated JavaScript. Rather
    9.29 - * generate completely independent JavaScript code.
    9.30 - *
    9.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    9.32 - */
    9.33 -@Retention(RetentionPolicy.CLASS)
    9.34 -@Target({ ElementType.METHOD, ElementType.FIELD })
    9.35 -public @interface JavaScriptOnly {
    9.36 -    /** name of the variable to assign given value to */
    9.37 -    String name() default "";
    9.38 -    /** value to assign to given field */
    9.39 -    String value() default "";
    9.40 -}
    10.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java	Fri Mar 22 16:59:47 2013 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,44 +0,0 @@
    10.4 -/**
    10.5 - * Back 2 Browser Bytecode Translator
    10.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    10.7 - *
    10.8 - * This program is free software: you can redistribute it and/or modify
    10.9 - * it under the terms of the GNU General Public License as published by
   10.10 - * the Free Software Foundation, version 2 of the License.
   10.11 - *
   10.12 - * This program is distributed in the hope that it will be useful,
   10.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.15 - * GNU General Public License for more details.
   10.16 - *
   10.17 - * You should have received a copy of the GNU General Public License
   10.18 - * along with this program. Look for COPYING file in the top folder.
   10.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
   10.20 - */
   10.21 -package org.apidesign.bck2brwsr.core;
   10.22 -
   10.23 -import java.lang.annotation.ElementType;
   10.24 -import java.lang.annotation.Retention;
   10.25 -import java.lang.annotation.RetentionPolicy;
   10.26 -import java.lang.annotation.Target;
   10.27 -
   10.28 -/** Controls how JavaScript inheritance should be handled.
   10.29 - * @author Jaroslav Tulach <jtulach@netbeans.org>
   10.30 - */
   10.31 -@Retention(RetentionPolicy.CLASS)
   10.32 -@Target({ ElementType.TYPE })
   10.33 -public @interface JavaScriptPrototype {
   10.34 -    /** Expression that identifies the function where all methods
   10.35 -     * should be added into. If this attribute is unspecified
   10.36 -     * all methods are added to the same object specified by
   10.37 -     * {@link #prototype()}.
   10.38 -     * 
   10.39 -     * @return name of function to contain methods found in given class
   10.40 -     */
   10.41 -    String container() default "";
   10.42 -    /** Expression that defines the way to construct prototype for this
   10.43 -     * class.
   10.44 -     * @return expression to construct prototype
   10.45 -     */
   10.46 -    String prototype();
   10.47 -}
    11.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java	Fri Mar 22 16:59:47 2013 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,94 +0,0 @@
    11.4 -/**
    11.5 - * Back 2 Browser Bytecode Translator
    11.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    11.7 - *
    11.8 - * This program is free software: you can redistribute it and/or modify
    11.9 - * it under the terms of the GNU General Public License as published by
   11.10 - * the Free Software Foundation, version 2 of the License.
   11.11 - *
   11.12 - * This program is distributed in the hope that it will be useful,
   11.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.15 - * GNU General Public License for more details.
   11.16 - *
   11.17 - * You should have received a copy of the GNU General Public License
   11.18 - * along with this program. Look for COPYING file in the top folder.
   11.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
   11.20 - */
   11.21 -package org.apidesign.bck2brwsr.core.impl;
   11.22 -
   11.23 -import java.util.Collections;
   11.24 -import java.util.HashSet;
   11.25 -import java.util.List;
   11.26 -import java.util.Set;
   11.27 -import javax.annotation.processing.AbstractProcessor;
   11.28 -import javax.annotation.processing.Completion;
   11.29 -import javax.annotation.processing.Completions;
   11.30 -import javax.annotation.processing.Processor;
   11.31 -import javax.annotation.processing.RoundEnvironment;
   11.32 -import javax.lang.model.element.AnnotationMirror;
   11.33 -import javax.lang.model.element.Element;
   11.34 -import javax.lang.model.element.ElementKind;
   11.35 -import javax.lang.model.element.ExecutableElement;
   11.36 -import javax.lang.model.element.TypeElement;
   11.37 -import javax.lang.model.element.VariableElement;
   11.38 -import javax.tools.Diagnostic;
   11.39 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
   11.40 -import org.openide.util.lookup.ServiceProvider;
   11.41 -
   11.42 -/**
   11.43 - *
   11.44 - * @author Jaroslav Tulach <jtulach@netbeans.org>
   11.45 - */
   11.46 -@ServiceProvider(service = Processor.class)
   11.47 -public final class JavaScriptProcesor extends AbstractProcessor {
   11.48 -    @Override
   11.49 -    public Set<String> getSupportedAnnotationTypes() {
   11.50 -        Set<String> set = new HashSet<>();
   11.51 -        set.add(JavaScriptBody.class.getName());
   11.52 -        return set;
   11.53 -    }
   11.54 -    
   11.55 -    @Override
   11.56 -    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   11.57 -        for (Element e : roundEnv.getElementsAnnotatedWith(JavaScriptBody.class)) {
   11.58 -            if (e.getKind() != ElementKind.METHOD && e.getKind() != ElementKind.CONSTRUCTOR) {
   11.59 -                continue;
   11.60 -            }
   11.61 -            ExecutableElement ee = (ExecutableElement)e;
   11.62 -            List<? extends VariableElement> params = ee.getParameters();
   11.63 -            
   11.64 -            JavaScriptBody jsb = e.getAnnotation(JavaScriptBody.class);
   11.65 -            if (jsb == null) {
   11.66 -                continue;
   11.67 -            }
   11.68 -            String[] arr = jsb.args();
   11.69 -            if (params.size() != arr.length) {
   11.70 -                processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Number of args arguments does not match real arguments!", e);
   11.71 -            }
   11.72 -        }
   11.73 -        return true;
   11.74 -    }
   11.75 -
   11.76 -    @Override
   11.77 -    public Iterable<? extends Completion> getCompletions(Element e, 
   11.78 -        AnnotationMirror annotation, ExecutableElement member, String userText
   11.79 -    ) {
   11.80 -        StringBuilder sb = new StringBuilder();
   11.81 -        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("args")) {
   11.82 -            ExecutableElement ee = (ExecutableElement) e;
   11.83 -            String sep = "";
   11.84 -            sb.append("{ ");
   11.85 -            for (VariableElement ve : ee.getParameters()) {
   11.86 -                sb.append(sep).append('"').append(ve.getSimpleName())
   11.87 -                    .append('"');
   11.88 -                sep = ", ";
   11.89 -            }
   11.90 -            sb.append(" }");
   11.91 -            return Collections.nCopies(1, Completions.of(sb.toString()));
   11.92 -        }
   11.93 -        return null;
   11.94 -    }
   11.95 -
   11.96 -    
   11.97 -}
    12.1 --- a/dew/pom.xml	Fri Mar 22 16:59:47 2013 +0100
    12.2 +++ b/dew/pom.xml	Fri Mar 22 17:03:32 2013 +0100
    12.3 @@ -1,15 +1,14 @@
    12.4  <?xml version="1.0"?>
    12.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"
    12.6 -    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    12.7 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    12.8    <modelVersion>4.0.0</modelVersion>
    12.9    <parent>
   12.10      <groupId>org.apidesign</groupId>
   12.11      <artifactId>bck2brwsr</artifactId>
   12.12 -    <version>0.3-SNAPSHOT</version>
   12.13 +    <version>0.5-SNAPSHOT</version>
   12.14    </parent>
   12.15    <groupId>org.apidesign.bck2brwsr</groupId>
   12.16    <artifactId>dew</artifactId>
   12.17 -  <version>0.3-SNAPSHOT</version>
   12.18 +  <version>0.5-SNAPSHOT</version>
   12.19    <name>Development Environment for Web</name>
   12.20    <url>http://maven.apache.org</url>
   12.21      <build>
   12.22 @@ -38,11 +37,19 @@
   12.23                      <executable>java</executable>
   12.24                       <arguments>
   12.25                          <argument>-classpath</argument>
   12.26 -                        <classpath/>
   12.27 +                        <classpath />
   12.28                          <argument>org.apidesign.bck2brwsr.dew.Dew</argument>
   12.29                      </arguments>
   12.30                  </configuration>
   12.31              </plugin>
   12.32 +            <plugin>
   12.33 +                <groupId>org.apache.maven.plugins</groupId>
   12.34 +                <artifactId>maven-deploy-plugin</artifactId>
   12.35 +                <version>2.7</version>
   12.36 +                <configuration>
   12.37 +                    <skip>true</skip>
   12.38 +                </configuration>
   12.39 +            </plugin>      
   12.40          </plugins>
   12.41      </build>
   12.42      <properties>
    13.1 --- a/emul/compact/pom.xml	Fri Mar 22 16:59:47 2013 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,72 +0,0 @@
    13.4 -<?xml version="1.0"?>
    13.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"
    13.6 -    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    13.7 -  <modelVersion>4.0.0</modelVersion>
    13.8 -  <parent>
    13.9 -    <groupId>org.apidesign.bck2brwsr</groupId>
   13.10 -    <artifactId>emul.pom</artifactId>
   13.11 -    <version>0.3-SNAPSHOT</version>
   13.12 -  </parent>
   13.13 -  <groupId>org.apidesign.bck2brwsr</groupId>
   13.14 -  <artifactId>emul</artifactId>
   13.15 -  <version>0.3-SNAPSHOT</version>
   13.16 -  <name>Bck2Brwsr API Profile</name>
   13.17 -  <url>http://maven.apache.org</url>
   13.18 -  <properties>
   13.19 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   13.20 -  </properties>
   13.21 -  <dependencies>
   13.22 -    <dependency>
   13.23 -      <groupId>${project.groupId}</groupId>
   13.24 -      <artifactId>emul.mini</artifactId>
   13.25 -      <version>${project.version}</version>
   13.26 -      <scope>provided</scope>
   13.27 -    </dependency>
   13.28 -    <dependency>
   13.29 -      <groupId>${project.groupId}</groupId>
   13.30 -      <artifactId>vmtest</artifactId>
   13.31 -      <version>${project.version}</version>
   13.32 -      <scope>test</scope>
   13.33 -    </dependency>
   13.34 -    <dependency>
   13.35 -      <groupId>org.netbeans.api</groupId>
   13.36 -      <artifactId>org-openide-util-lookup</artifactId>
   13.37 -      <scope>test</scope>
   13.38 -    </dependency>
   13.39 -  </dependencies>
   13.40 -  <build>
   13.41 -      <plugins>
   13.42 -          <plugin>
   13.43 -              <groupId>org.apache.maven.plugins</groupId>
   13.44 -              <artifactId>maven-compiler-plugin</artifactId>
   13.45 -              <version>2.5.1</version>
   13.46 -              <configuration>
   13.47 -                  <compilerArguments>
   13.48 -                      <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
   13.49 -                  </compilerArguments>
   13.50 -                 <source>1.7</source>
   13.51 -                 <target>1.7</target>
   13.52 -              </configuration>
   13.53 -          </plugin>
   13.54 -         <plugin>
   13.55 -            <artifactId>maven-assembly-plugin</artifactId>
   13.56 -                <version>2.4</version>
   13.57 -                <executions>
   13.58 -                    <execution>
   13.59 -                        <id>rt</id>
   13.60 -                        <phase>package</phase>
   13.61 -                        <goals>
   13.62 -                            <goal>single</goal>
   13.63 -                        </goals>
   13.64 -                        <configuration>
   13.65 -                            <descriptors>
   13.66 -                                <descriptor>src/main/assembly/rt.xml</descriptor>
   13.67 -                            </descriptors>
   13.68 -                            <finalName>bck2brwsr-${project.version}</finalName>
   13.69 -                        </configuration>
   13.70 -                    </execution>
   13.71 -                </executions>                
   13.72 -            </plugin>      
   13.73 -      </plugins>
   13.74 -  </build>
   13.75 -</project>
    14.1 --- a/emul/compact/src/main/assembly/rt.xml	Fri Mar 22 16:59:47 2013 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,26 +0,0 @@
    14.4 -<?xml version="1.0"?>
    14.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">
    14.6 -  <id>rt</id>
    14.7 -  <formats>
    14.8 -    <format>jar</format>
    14.9 -  </formats>
   14.10 -  <includeBaseDirectory>false</includeBaseDirectory>
   14.11 -  <dependencySets>
   14.12 -    <dependencySet>
   14.13 -      <useProjectArtifact>true</useProjectArtifact>
   14.14 -      <unpack>true</unpack>
   14.15 -      <scope>provided</scope>
   14.16 -      <unpackOptions>
   14.17 -        <excludes>
   14.18 -          <exclude>META-INF/maven/**</exclude>
   14.19 -        </excludes>
   14.20 -      </unpackOptions>
   14.21 -    </dependencySet>
   14.22 -  </dependencySets>
   14.23 -  <fileSets>
   14.24 -    <fileSet>
   14.25 -      <directory>${project.build.outputDirectory}</directory>
   14.26 -      <outputDirectory>/</outputDirectory>
   14.27 -    </fileSet>
   14.28 -  </fileSets>
   14.29 -</assembly>
   14.30 \ No newline at end of file
    15.1 --- a/emul/compact/src/main/java/java/beans/ChangeListenerMap.java	Fri Mar 22 16:59:47 2013 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,248 +0,0 @@
    15.4 -/*
    15.5 - * Copyright (c) 2007, 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 -package java.beans;
   15.29 -
   15.30 -import java.util.ArrayList;
   15.31 -import java.util.Collections;
   15.32 -import java.util.EventListener;
   15.33 -import java.util.EventListenerProxy;
   15.34 -import java.util.HashMap;
   15.35 -import java.util.List;
   15.36 -import java.util.Map;
   15.37 -import java.util.Map.Entry;
   15.38 -import java.util.Set;
   15.39 -import org.apidesign.bck2brwsr.emul.lang.System;
   15.40 -
   15.41 -/**
   15.42 - * This is an abstract class that provides base functionality
   15.43 - * for the {@link PropertyChangeSupport PropertyChangeSupport} class
   15.44 - * and the {@link VetoableChangeSupport VetoableChangeSupport} class.
   15.45 - *
   15.46 - * @see PropertyChangeListenerMap
   15.47 - * @see VetoableChangeListenerMap
   15.48 - *
   15.49 - * @author Sergey A. Malenkov
   15.50 - */
   15.51 -abstract class ChangeListenerMap<L extends EventListener> {
   15.52 -    private Map<String, L[]> map;
   15.53 -
   15.54 -    /**
   15.55 -     * Creates an array of listeners.
   15.56 -     * This method can be optimized by using
   15.57 -     * the same instance of the empty array
   15.58 -     * when {@code length} is equal to {@code 0}.
   15.59 -     *
   15.60 -     * @param length  the array length
   15.61 -     * @return        an array with specified length
   15.62 -     */
   15.63 -    protected abstract L[] newArray(int length);
   15.64 -
   15.65 -    /**
   15.66 -     * Creates a proxy listener for the specified property.
   15.67 -     *
   15.68 -     * @param name      the name of the property to listen on
   15.69 -     * @param listener  the listener to process events
   15.70 -     * @return          a proxy listener
   15.71 -     */
   15.72 -    protected abstract L newProxy(String name, L listener);
   15.73 -
   15.74 -    /**
   15.75 -     * Adds a listener to the list of listeners for the specified property.
   15.76 -     * This listener is called as many times as it was added.
   15.77 -     *
   15.78 -     * @param name      the name of the property to listen on
   15.79 -     * @param listener  the listener to process events
   15.80 -     */
   15.81 -    public final synchronized void add(String name, L listener) {
   15.82 -        if (this.map == null) {
   15.83 -            this.map = new HashMap<String, L[]>();
   15.84 -        }
   15.85 -        L[] array = this.map.get(name);
   15.86 -        int size = (array != null)
   15.87 -                ? array.length
   15.88 -                : 0;
   15.89 -
   15.90 -        L[] clone = newArray(size + 1);
   15.91 -        clone[size] = listener;
   15.92 -        if (array != null) {
   15.93 -            System.arraycopy(array, 0, clone, 0, size);
   15.94 -        }
   15.95 -        this.map.put(name, clone);
   15.96 -    }
   15.97 -
   15.98 -    /**
   15.99 -     * Removes a listener from the list of listeners for the specified property.
  15.100 -     * If the listener was added more than once to the same event source,
  15.101 -     * this listener will be notified one less time after being removed.
  15.102 -     *
  15.103 -     * @param name      the name of the property to listen on
  15.104 -     * @param listener  the listener to process events
  15.105 -     */
  15.106 -    public final synchronized void remove(String name, L listener) {
  15.107 -        if (this.map != null) {
  15.108 -            L[] array = this.map.get(name);
  15.109 -            if (array != null) {
  15.110 -                for (int i = 0; i < array.length; i++) {
  15.111 -                    if (listener.equals(array[i])) {
  15.112 -                        int size = array.length - 1;
  15.113 -                        if (size > 0) {
  15.114 -                            L[] clone = newArray(size);
  15.115 -                            System.arraycopy(array, 0, clone, 0, i);
  15.116 -                            System.arraycopy(array, i + 1, clone, i, size - i);
  15.117 -                            this.map.put(name, clone);
  15.118 -                        }
  15.119 -                        else {
  15.120 -                            this.map.remove(name);
  15.121 -                            if (this.map.isEmpty()) {
  15.122 -                                this.map = null;
  15.123 -                            }
  15.124 -                        }
  15.125 -                        break;
  15.126 -                    }
  15.127 -                }
  15.128 -            }
  15.129 -        }
  15.130 -    }
  15.131 -
  15.132 -    /**
  15.133 -     * Returns the list of listeners for the specified property.
  15.134 -     *
  15.135 -     * @param name  the name of the property
  15.136 -     * @return      the corresponding list of listeners
  15.137 -     */
  15.138 -    public final synchronized L[] get(String name) {
  15.139 -        return (this.map != null)
  15.140 -                ? this.map.get(name)
  15.141 -                : null;
  15.142 -    }
  15.143 -
  15.144 -    /**
  15.145 -     * Sets new list of listeners for the specified property.
  15.146 -     *
  15.147 -     * @param name       the name of the property
  15.148 -     * @param listeners  new list of listeners
  15.149 -     */
  15.150 -    public final void set(String name, L[] listeners) {
  15.151 -        if (listeners != null) {
  15.152 -            if (this.map == null) {
  15.153 -                this.map = new HashMap<String, L[]>();
  15.154 -            }
  15.155 -            this.map.put(name, listeners);
  15.156 -        }
  15.157 -        else if (this.map != null) {
  15.158 -            this.map.remove(name);
  15.159 -            if (this.map.isEmpty()) {
  15.160 -                this.map = null;
  15.161 -            }
  15.162 -        }
  15.163 -    }
  15.164 -
  15.165 -    /**
  15.166 -     * Returns all listeners in the map.
  15.167 -     *
  15.168 -     * @return an array of all listeners
  15.169 -     */
  15.170 -    public final synchronized L[] getListeners() {
  15.171 -        if (this.map == null) {
  15.172 -            return newArray(0);
  15.173 -        }
  15.174 -        List<L> list = new ArrayList<L>();
  15.175 -
  15.176 -        L[] listeners = this.map.get(null);
  15.177 -        if (listeners != null) {
  15.178 -            for (L listener : listeners) {
  15.179 -                list.add(listener);
  15.180 -            }
  15.181 -        }
  15.182 -        for (Entry<String, L[]> entry : this.map.entrySet()) {
  15.183 -            String name = entry.getKey();
  15.184 -            if (name != null) {
  15.185 -                for (L listener : entry.getValue()) {
  15.186 -                    list.add(newProxy(name, listener));
  15.187 -                }
  15.188 -            }
  15.189 -        }
  15.190 -        return list.toArray(newArray(list.size()));
  15.191 -    }
  15.192 -
  15.193 -    /**
  15.194 -     * Returns listeners that have been associated with the named property.
  15.195 -     *
  15.196 -     * @param name  the name of the property
  15.197 -     * @return an array of listeners for the named property
  15.198 -     */
  15.199 -    public final L[] getListeners(String name) {
  15.200 -        if (name != null) {
  15.201 -            L[] listeners = get(name);
  15.202 -            if (listeners != null) {
  15.203 -                return listeners.clone();
  15.204 -            }
  15.205 -        }
  15.206 -        return newArray(0);
  15.207 -    }
  15.208 -
  15.209 -    /**
  15.210 -     * Indicates whether the map contains
  15.211 -     * at least one listener to be notified.
  15.212 -     *
  15.213 -     * @param name  the name of the property
  15.214 -     * @return      {@code true} if at least one listener exists or
  15.215 -     *              {@code false} otherwise
  15.216 -     */
  15.217 -    public final synchronized boolean hasListeners(String name) {
  15.218 -        if (this.map == null) {
  15.219 -            return false;
  15.220 -        }
  15.221 -        L[] array = this.map.get(null);
  15.222 -        return (array != null) || ((name != null) && (null != this.map.get(name)));
  15.223 -    }
  15.224 -
  15.225 -    /**
  15.226 -     * Returns a set of entries from the map.
  15.227 -     * Each entry is a pair consisted of the property name
  15.228 -     * and the corresponding list of listeners.
  15.229 -     *
  15.230 -     * @return a set of entries from the map
  15.231 -     */
  15.232 -    public final Set<Entry<String, L[]>> getEntries() {
  15.233 -        return (this.map != null)
  15.234 -                ? this.map.entrySet()
  15.235 -                : Collections.<Entry<String, L[]>>emptySet();
  15.236 -    }
  15.237 -
  15.238 -    /**
  15.239 -     * Extracts a real listener from the proxy listener.
  15.240 -     * It is necessary because default proxy class is not serializable.
  15.241 -     *
  15.242 -     * @return a real listener
  15.243 -     */
  15.244 -    public final L extract(L listener) {
  15.245 -        while (listener instanceof EventListenerProxy) {
  15.246 -            EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener;
  15.247 -            listener = proxy.getListener();
  15.248 -        }
  15.249 -        return listener;
  15.250 -    }
  15.251 -}
    16.1 --- a/emul/compact/src/main/java/java/beans/IndexedPropertyChangeEvent.java	Fri Mar 22 16:59:47 2013 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,78 +0,0 @@
    16.4 -/*
    16.5 - * Copyright (c) 2003, 2011, 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 -package java.beans;
   16.29 -
   16.30 -/**
   16.31 - * An "IndexedPropertyChange" event gets delivered whenever a component that
   16.32 - * conforms to the JavaBeans&trade; specification (a "bean") changes a bound
   16.33 - * indexed property. This class is an extension of <code>PropertyChangeEvent</code>
   16.34 - * but contains the index of the property that has changed.
   16.35 - * <P>
   16.36 - * Null values may be provided for the old and the new values if their
   16.37 - * true values are not known.
   16.38 - * <P>
   16.39 - * An event source may send a null object as the name to indicate that an
   16.40 - * arbitrary set of if its properties have changed.  In this case the
   16.41 - * old and new values should also be null.
   16.42 - *
   16.43 - * @since 1.5
   16.44 - * @author Mark Davidson
   16.45 - */
   16.46 -public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
   16.47 -    private static final long serialVersionUID = -320227448495806870L;
   16.48 -
   16.49 -    private int index;
   16.50 -
   16.51 -    /**
   16.52 -     * Constructs a new <code>IndexedPropertyChangeEvent</code> object.
   16.53 -     *
   16.54 -     * @param source  The bean that fired the event.
   16.55 -     * @param propertyName  The programmatic name of the property that
   16.56 -     *             was changed.
   16.57 -     * @param oldValue      The old value of the property.
   16.58 -     * @param newValue      The new value of the property.
   16.59 -     * @param index index of the property element that was changed.
   16.60 -     */
   16.61 -    public IndexedPropertyChangeEvent(Object source, String propertyName,
   16.62 -                                      Object oldValue, Object newValue,
   16.63 -                                      int index) {
   16.64 -        super (source, propertyName, oldValue, newValue);
   16.65 -        this.index = index;
   16.66 -    }
   16.67 -
   16.68 -    /**
   16.69 -     * Gets the index of the property that was changed.
   16.70 -     *
   16.71 -     * @return The index specifying the property element that was
   16.72 -     *         changed.
   16.73 -     */
   16.74 -    public int getIndex() {
   16.75 -        return index;
   16.76 -    }
   16.77 -
   16.78 -    void appendTo(StringBuilder sb) {
   16.79 -        sb.append("; index=").append(getIndex());
   16.80 -    }
   16.81 -}
    17.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeEvent.java	Fri Mar 22 16:59:47 2013 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,164 +0,0 @@
    17.4 -/*
    17.5 - * Copyright (c) 1996, 2010, 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 -/**
   17.32 - * A "PropertyChange" event gets delivered whenever a bean changes a "bound"
   17.33 - * or "constrained" property.  A PropertyChangeEvent object is sent as an
   17.34 - * argument to the PropertyChangeListener and VetoableChangeListener methods.
   17.35 - * <P>
   17.36 - * Normally PropertyChangeEvents are accompanied by the name and the old
   17.37 - * and new value of the changed property.  If the new value is a primitive
   17.38 - * type (such as int or boolean) it must be wrapped as the
   17.39 - * corresponding java.lang.* Object type (such as Integer or Boolean).
   17.40 - * <P>
   17.41 - * Null values may be provided for the old and the new values if their
   17.42 - * true values are not known.
   17.43 - * <P>
   17.44 - * An event source may send a null object as the name to indicate that an
   17.45 - * arbitrary set of if its properties have changed.  In this case the
   17.46 - * old and new values should also be null.
   17.47 - */
   17.48 -
   17.49 -public class PropertyChangeEvent extends java.util.EventObject {
   17.50 -    private static final long serialVersionUID = 7042693688939648123L;
   17.51 -
   17.52 -    /**
   17.53 -     * Constructs a new <code>PropertyChangeEvent</code>.
   17.54 -     *
   17.55 -     * @param source  The bean that fired the event.
   17.56 -     * @param propertyName  The programmatic name of the property
   17.57 -     *          that was changed.
   17.58 -     * @param oldValue  The old value of the property.
   17.59 -     * @param newValue  The new value of the property.
   17.60 -     */
   17.61 -    public PropertyChangeEvent(Object source, String propertyName,
   17.62 -                                     Object oldValue, Object newValue) {
   17.63 -        super(source);
   17.64 -        this.propertyName = propertyName;
   17.65 -        this.newValue = newValue;
   17.66 -        this.oldValue = oldValue;
   17.67 -    }
   17.68 -
   17.69 -    /**
   17.70 -     * Gets the programmatic name of the property that was changed.
   17.71 -     *
   17.72 -     * @return  The programmatic name of the property that was changed.
   17.73 -     *          May be null if multiple properties have changed.
   17.74 -     */
   17.75 -    public String getPropertyName() {
   17.76 -        return propertyName;
   17.77 -    }
   17.78 -
   17.79 -    /**
   17.80 -     * Gets the new value for the property, expressed as an Object.
   17.81 -     *
   17.82 -     * @return  The new value for the property, expressed as an Object.
   17.83 -     *          May be null if multiple properties have changed.
   17.84 -     */
   17.85 -    public Object getNewValue() {
   17.86 -        return newValue;
   17.87 -    }
   17.88 -
   17.89 -    /**
   17.90 -     * Gets the old value for the property, expressed as an Object.
   17.91 -     *
   17.92 -     * @return  The old value for the property, expressed as an Object.
   17.93 -     *          May be null if multiple properties have changed.
   17.94 -     */
   17.95 -    public Object getOldValue() {
   17.96 -        return oldValue;
   17.97 -    }
   17.98 -
   17.99 -    /**
  17.100 -     * Sets the propagationId object for the event.
  17.101 -     *
  17.102 -     * @param propagationId  The propagationId object for the event.
  17.103 -     */
  17.104 -    public void setPropagationId(Object propagationId) {
  17.105 -        this.propagationId = propagationId;
  17.106 -    }
  17.107 -
  17.108 -    /**
  17.109 -     * The "propagationId" field is reserved for future use.  In Beans 1.0
  17.110 -     * the sole requirement is that if a listener catches a PropertyChangeEvent
  17.111 -     * and then fires a PropertyChangeEvent of its own, then it should
  17.112 -     * make sure that it propagates the propagationId field from its
  17.113 -     * incoming event to its outgoing event.
  17.114 -     *
  17.115 -     * @return the propagationId object associated with a bound/constrained
  17.116 -     *          property update.
  17.117 -     */
  17.118 -    public Object getPropagationId() {
  17.119 -        return propagationId;
  17.120 -    }
  17.121 -
  17.122 -    /**
  17.123 -     * name of the property that changed.  May be null, if not known.
  17.124 -     * @serial
  17.125 -     */
  17.126 -    private String propertyName;
  17.127 -
  17.128 -    /**
  17.129 -     * New value for property.  May be null if not known.
  17.130 -     * @serial
  17.131 -     */
  17.132 -    private Object newValue;
  17.133 -
  17.134 -    /**
  17.135 -     * Previous value for property.  May be null if not known.
  17.136 -     * @serial
  17.137 -     */
  17.138 -    private Object oldValue;
  17.139 -
  17.140 -    /**
  17.141 -     * Propagation ID.  May be null.
  17.142 -     * @serial
  17.143 -     * @see #getPropagationId
  17.144 -     */
  17.145 -    private Object propagationId;
  17.146 -
  17.147 -    /**
  17.148 -     * Returns a string representation of the object.
  17.149 -     *
  17.150 -     * @return a string representation of the object
  17.151 -     *
  17.152 -     * @since 1.7
  17.153 -     */
  17.154 -    public String toString() {
  17.155 -        StringBuilder sb = new StringBuilder(getClass().getName());
  17.156 -        sb.append("[propertyName=").append(getPropertyName());
  17.157 -        appendTo(sb);
  17.158 -        sb.append("; oldValue=").append(getOldValue());
  17.159 -        sb.append("; newValue=").append(getNewValue());
  17.160 -        sb.append("; propagationId=").append(getPropagationId());
  17.161 -        sb.append("; source=").append(getSource());
  17.162 -        return sb.append("]").toString();
  17.163 -    }
  17.164 -
  17.165 -    void appendTo(StringBuilder sb) {
  17.166 -    }
  17.167 -}
    18.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeListener.java	Fri Mar 22 16:59:47 2013 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,44 +0,0 @@
    18.4 -/*
    18.5 - * Copyright (c) 1996, 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 -
   18.29 -package java.beans;
   18.30 -
   18.31 -/**
   18.32 - * A "PropertyChange" event gets fired whenever a bean changes a "bound"
   18.33 - * property.  You can register a PropertyChangeListener with a source
   18.34 - * bean so as to be notified of any bound property updates.
   18.35 - */
   18.36 -
   18.37 -public interface PropertyChangeListener extends java.util.EventListener {
   18.38 -
   18.39 -    /**
   18.40 -     * This method gets called when a bound property is changed.
   18.41 -     * @param evt A PropertyChangeEvent object describing the event source
   18.42 -     *          and the property that has changed.
   18.43 -     */
   18.44 -
   18.45 -    void propertyChange(PropertyChangeEvent evt);
   18.46 -
   18.47 -}
    19.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeListenerProxy.java	Fri Mar 22 16:59:47 2013 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,81 +0,0 @@
    19.4 -/*
    19.5 - * Copyright (c) 2000, 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.beans;
   19.30 -
   19.31 -import java.util.EventListenerProxy;
   19.32 -
   19.33 -/**
   19.34 - * A class which extends the {@code EventListenerProxy}
   19.35 - * specifically for adding a {@code PropertyChangeListener}
   19.36 - * with a "bound" property.
   19.37 - * Instances of this class can be added
   19.38 - * as {@code PropertyChangeListener}s to a bean
   19.39 - * which supports firing property change events.
   19.40 - * <p>
   19.41 - * If the object has a {@code getPropertyChangeListeners} method
   19.42 - * then the array returned could be a mixture of {@code PropertyChangeListener}
   19.43 - * and {@code PropertyChangeListenerProxy} objects.
   19.44 - *
   19.45 - * @see java.util.EventListenerProxy
   19.46 - * @see PropertyChangeSupport#getPropertyChangeListeners
   19.47 - * @since 1.4
   19.48 - */
   19.49 -public class PropertyChangeListenerProxy
   19.50 -        extends EventListenerProxy<PropertyChangeListener>
   19.51 -        implements PropertyChangeListener {
   19.52 -
   19.53 -    private final String propertyName;
   19.54 -
   19.55 -    /**
   19.56 -     * Constructor which binds the {@code PropertyChangeListener}
   19.57 -     * to a specific property.
   19.58 -     *
   19.59 -     * @param propertyName  the name of the property to listen on
   19.60 -     * @param listener      the listener object
   19.61 -     */
   19.62 -    public PropertyChangeListenerProxy(String propertyName, PropertyChangeListener listener) {
   19.63 -        super(listener);
   19.64 -        this.propertyName = propertyName;
   19.65 -    }
   19.66 -
   19.67 -    /**
   19.68 -     * Forwards the property change event to the listener delegate.
   19.69 -     *
   19.70 -     * @param event  the property change event
   19.71 -     */
   19.72 -    public void propertyChange(PropertyChangeEvent event) {
   19.73 -        getListener().propertyChange(event);
   19.74 -    }
   19.75 -
   19.76 -    /**
   19.77 -     * Returns the name of the named property associated with the listener.
   19.78 -     *
   19.79 -     * @return the name of the named property associated with the listener
   19.80 -     */
   19.81 -    public String getPropertyName() {
   19.82 -        return this.propertyName;
   19.83 -    }
   19.84 -}
    20.1 --- a/emul/compact/src/main/java/java/beans/PropertyChangeSupport.java	Fri Mar 22 16:59:47 2013 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,536 +0,0 @@
    20.4 -/*
    20.5 - * Copyright (c) 1996, 2008, 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 -package java.beans;
   20.29 -
   20.30 -import java.io.Serializable;
   20.31 -import java.io.ObjectStreamField;
   20.32 -import java.io.ObjectOutputStream;
   20.33 -import java.io.ObjectInputStream;
   20.34 -import java.io.IOException;
   20.35 -import java.util.Hashtable;
   20.36 -import java.util.Map.Entry;
   20.37 -
   20.38 -/**
   20.39 - * This is a utility class that can be used by beans that support bound
   20.40 - * properties.  It manages a list of listeners and dispatches
   20.41 - * {@link PropertyChangeEvent}s to them.  You can use an instance of this class
   20.42 - * as a member field of your bean and delegate these types of work to it.
   20.43 - * The {@link PropertyChangeListener} can be registered for all properties
   20.44 - * or for a property specified by name.
   20.45 - * <p>
   20.46 - * Here is an example of {@code PropertyChangeSupport} usage that follows
   20.47 - * the rules and recommendations laid out in the JavaBeans&trade; specification:
   20.48 - * <pre>
   20.49 - * public class MyBean {
   20.50 - *     private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
   20.51 - *
   20.52 - *     public void addPropertyChangeListener(PropertyChangeListener listener) {
   20.53 - *         this.pcs.addPropertyChangeListener(listener);
   20.54 - *     }
   20.55 - *
   20.56 - *     public void removePropertyChangeListener(PropertyChangeListener listener) {
   20.57 - *         this.pcs.removePropertyChangeListener(listener);
   20.58 - *     }
   20.59 - *
   20.60 - *     private String value;
   20.61 - *
   20.62 - *     public String getValue() {
   20.63 - *         return this.value;
   20.64 - *     }
   20.65 - *
   20.66 - *     public void setValue(String newValue) {
   20.67 - *         String oldValue = this.value;
   20.68 - *         this.value = newValue;
   20.69 - *         this.pcs.firePropertyChange("value", oldValue, newValue);
   20.70 - *     }
   20.71 - *
   20.72 - *     [...]
   20.73 - * }
   20.74 - * </pre>
   20.75 - * <p>
   20.76 - * A {@code PropertyChangeSupport} instance is thread-safe.
   20.77 - * <p>
   20.78 - * This class is serializable.  When it is serialized it will save
   20.79 - * (and restore) any listeners that are themselves serializable.  Any
   20.80 - * non-serializable listeners will be skipped during serialization.
   20.81 - *
   20.82 - * @see VetoableChangeSupport
   20.83 - */
   20.84 -public class PropertyChangeSupport implements Serializable {
   20.85 -    private PropertyChangeListenerMap map = new PropertyChangeListenerMap();
   20.86 -
   20.87 -    /**
   20.88 -     * Constructs a <code>PropertyChangeSupport</code> object.
   20.89 -     *
   20.90 -     * @param sourceBean  The bean to be given as the source for any events.
   20.91 -     */
   20.92 -    public PropertyChangeSupport(Object sourceBean) {
   20.93 -        if (sourceBean == null) {
   20.94 -            throw new NullPointerException();
   20.95 -        }
   20.96 -        source = sourceBean;
   20.97 -    }
   20.98 -
   20.99 -    /**
  20.100 -     * Add a PropertyChangeListener to the listener list.
  20.101 -     * The listener is registered for all properties.
  20.102 -     * The same listener object may be added more than once, and will be called
  20.103 -     * as many times as it is added.
  20.104 -     * If <code>listener</code> is null, no exception is thrown and no action
  20.105 -     * is taken.
  20.106 -     *
  20.107 -     * @param listener  The PropertyChangeListener to be added
  20.108 -     */
  20.109 -    public void addPropertyChangeListener(PropertyChangeListener listener) {
  20.110 -        if (listener == null) {
  20.111 -            return;
  20.112 -        }
  20.113 -        if (listener instanceof PropertyChangeListenerProxy) {
  20.114 -            PropertyChangeListenerProxy proxy =
  20.115 -                   (PropertyChangeListenerProxy)listener;
  20.116 -            // Call two argument add method.
  20.117 -            addPropertyChangeListener(proxy.getPropertyName(),
  20.118 -                                      proxy.getListener());
  20.119 -        } else {
  20.120 -            this.map.add(null, listener);
  20.121 -        }
  20.122 -    }
  20.123 -
  20.124 -    /**
  20.125 -     * Remove a PropertyChangeListener from the listener list.
  20.126 -     * This removes a PropertyChangeListener that was registered
  20.127 -     * for all properties.
  20.128 -     * If <code>listener</code> was added more than once to the same event
  20.129 -     * source, it will be notified one less time after being removed.
  20.130 -     * If <code>listener</code> is null, or was never added, no exception is
  20.131 -     * thrown and no action is taken.
  20.132 -     *
  20.133 -     * @param listener  The PropertyChangeListener to be removed
  20.134 -     */
  20.135 -    public void removePropertyChangeListener(PropertyChangeListener listener) {
  20.136 -        if (listener == null) {
  20.137 -            return;
  20.138 -        }
  20.139 -        if (listener instanceof PropertyChangeListenerProxy) {
  20.140 -            PropertyChangeListenerProxy proxy =
  20.141 -                    (PropertyChangeListenerProxy)listener;
  20.142 -            // Call two argument remove method.
  20.143 -            removePropertyChangeListener(proxy.getPropertyName(),
  20.144 -                                         proxy.getListener());
  20.145 -        } else {
  20.146 -            this.map.remove(null, listener);
  20.147 -        }
  20.148 -    }
  20.149 -
  20.150 -    /**
  20.151 -     * Returns an array of all the listeners that were added to the
  20.152 -     * PropertyChangeSupport object with addPropertyChangeListener().
  20.153 -     * <p>
  20.154 -     * If some listeners have been added with a named property, then
  20.155 -     * the returned array will be a mixture of PropertyChangeListeners
  20.156 -     * and <code>PropertyChangeListenerProxy</code>s. If the calling
  20.157 -     * method is interested in distinguishing the listeners then it must
  20.158 -     * test each element to see if it's a
  20.159 -     * <code>PropertyChangeListenerProxy</code>, perform the cast, and examine
  20.160 -     * the parameter.
  20.161 -     *
  20.162 -     * <pre>
  20.163 -     * PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
  20.164 -     * for (int i = 0; i < listeners.length; i++) {
  20.165 -     *   if (listeners[i] instanceof PropertyChangeListenerProxy) {
  20.166 -     *     PropertyChangeListenerProxy proxy =
  20.167 -     *                    (PropertyChangeListenerProxy)listeners[i];
  20.168 -     *     if (proxy.getPropertyName().equals("foo")) {
  20.169 -     *       // proxy is a PropertyChangeListener which was associated
  20.170 -     *       // with the property named "foo"
  20.171 -     *     }
  20.172 -     *   }
  20.173 -     * }
  20.174 -     *</pre>
  20.175 -     *
  20.176 -     * @see PropertyChangeListenerProxy
  20.177 -     * @return all of the <code>PropertyChangeListeners</code> added or an
  20.178 -     *         empty array if no listeners have been added
  20.179 -     * @since 1.4
  20.180 -     */
  20.181 -    public PropertyChangeListener[] getPropertyChangeListeners() {
  20.182 -        return this.map.getListeners();
  20.183 -    }
  20.184 -
  20.185 -    /**
  20.186 -     * Add a PropertyChangeListener for a specific property.  The listener
  20.187 -     * will be invoked only when a call on firePropertyChange names that
  20.188 -     * specific property.
  20.189 -     * The same listener object may be added more than once.  For each
  20.190 -     * property,  the listener will be invoked the number of times it was added
  20.191 -     * for that property.
  20.192 -     * If <code>propertyName</code> or <code>listener</code> is null, no
  20.193 -     * exception is thrown and no action is taken.
  20.194 -     *
  20.195 -     * @param propertyName  The name of the property to listen on.
  20.196 -     * @param listener  The PropertyChangeListener to be added
  20.197 -     */
  20.198 -    public void addPropertyChangeListener(
  20.199 -                String propertyName,
  20.200 -                PropertyChangeListener listener) {
  20.201 -        if (listener == null || propertyName == null) {
  20.202 -            return;
  20.203 -        }
  20.204 -        listener = this.map.extract(listener);
  20.205 -        if (listener != null) {
  20.206 -            this.map.add(propertyName, listener);
  20.207 -        }
  20.208 -    }
  20.209 -
  20.210 -    /**
  20.211 -     * Remove a PropertyChangeListener for a specific property.
  20.212 -     * If <code>listener</code> was added more than once to the same event
  20.213 -     * source for the specified property, it will be notified one less time
  20.214 -     * after being removed.
  20.215 -     * If <code>propertyName</code> is null,  no exception is thrown and no
  20.216 -     * action is taken.
  20.217 -     * If <code>listener</code> is null, or was never added for the specified
  20.218 -     * property, no exception is thrown and no action is taken.
  20.219 -     *
  20.220 -     * @param propertyName  The name of the property that was listened on.
  20.221 -     * @param listener  The PropertyChangeListener to be removed
  20.222 -     */
  20.223 -    public void removePropertyChangeListener(
  20.224 -                String propertyName,
  20.225 -                PropertyChangeListener listener) {
  20.226 -        if (listener == null || propertyName == null) {
  20.227 -            return;
  20.228 -        }
  20.229 -        listener = this.map.extract(listener);
  20.230 -        if (listener != null) {
  20.231 -            this.map.remove(propertyName, listener);
  20.232 -        }
  20.233 -    }
  20.234 -
  20.235 -    /**
  20.236 -     * Returns an array of all the listeners which have been associated
  20.237 -     * with the named property.
  20.238 -     *
  20.239 -     * @param propertyName  The name of the property being listened to
  20.240 -     * @return all of the <code>PropertyChangeListeners</code> associated with
  20.241 -     *         the named property.  If no such listeners have been added,
  20.242 -     *         or if <code>propertyName</code> is null, an empty array is
  20.243 -     *         returned.
  20.244 -     * @since 1.4
  20.245 -     */
  20.246 -    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
  20.247 -        return this.map.getListeners(propertyName);
  20.248 -    }
  20.249 -
  20.250 -    /**
  20.251 -     * Reports a bound property update to listeners
  20.252 -     * that have been registered to track updates of
  20.253 -     * all properties or a property with the specified name.
  20.254 -     * <p>
  20.255 -     * No event is fired if old and new values are equal and non-null.
  20.256 -     * <p>
  20.257 -     * This is merely a convenience wrapper around the more general
  20.258 -     * {@link #firePropertyChange(PropertyChangeEvent)} method.
  20.259 -     *
  20.260 -     * @param propertyName  the programmatic name of the property that was changed
  20.261 -     * @param oldValue      the old value of the property
  20.262 -     * @param newValue      the new value of the property
  20.263 -     */
  20.264 -    public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
  20.265 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  20.266 -            firePropertyChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
  20.267 -        }
  20.268 -    }
  20.269 -
  20.270 -    /**
  20.271 -     * Reports an integer bound property update to listeners
  20.272 -     * that have been registered to track updates of
  20.273 -     * all properties or a property with the specified name.
  20.274 -     * <p>
  20.275 -     * No event is fired if old and new values are equal.
  20.276 -     * <p>
  20.277 -     * This is merely a convenience wrapper around the more general
  20.278 -     * {@link #firePropertyChange(String, Object, Object)}  method.
  20.279 -     *
  20.280 -     * @param propertyName  the programmatic name of the property that was changed
  20.281 -     * @param oldValue      the old value of the property
  20.282 -     * @param newValue      the new value of the property
  20.283 -     */
  20.284 -    public void firePropertyChange(String propertyName, int oldValue, int newValue) {
  20.285 -        if (oldValue != newValue) {
  20.286 -            firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  20.287 -        }
  20.288 -    }
  20.289 -
  20.290 -    /**
  20.291 -     * Reports a boolean bound property update to listeners
  20.292 -     * that have been registered to track updates of
  20.293 -     * all properties or a property with the specified name.
  20.294 -     * <p>
  20.295 -     * No event is fired if old and new values are equal.
  20.296 -     * <p>
  20.297 -     * This is merely a convenience wrapper around the more general
  20.298 -     * {@link #firePropertyChange(String, Object, Object)}  method.
  20.299 -     *
  20.300 -     * @param propertyName  the programmatic name of the property that was changed
  20.301 -     * @param oldValue      the old value of the property
  20.302 -     * @param newValue      the new value of the property
  20.303 -     */
  20.304 -    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
  20.305 -        if (oldValue != newValue) {
  20.306 -            firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  20.307 -        }
  20.308 -    }
  20.309 -
  20.310 -    /**
  20.311 -     * Fires a property change event to listeners
  20.312 -     * that have been registered to track updates of
  20.313 -     * all properties or a property with the specified name.
  20.314 -     * <p>
  20.315 -     * No event is fired if the given event's old and new values are equal and non-null.
  20.316 -     *
  20.317 -     * @param event  the {@code PropertyChangeEvent} to be fired
  20.318 -     */
  20.319 -    public void firePropertyChange(PropertyChangeEvent event) {
  20.320 -        Object oldValue = event.getOldValue();
  20.321 -        Object newValue = event.getNewValue();
  20.322 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  20.323 -            String name = event.getPropertyName();
  20.324 -
  20.325 -            PropertyChangeListener[] common = this.map.get(null);
  20.326 -            PropertyChangeListener[] named = (name != null)
  20.327 -                        ? this.map.get(name)
  20.328 -                        : null;
  20.329 -
  20.330 -            fire(common, event);
  20.331 -            fire(named, event);
  20.332 -        }
  20.333 -    }
  20.334 -
  20.335 -    private static void fire(PropertyChangeListener[] listeners, PropertyChangeEvent event) {
  20.336 -        if (listeners != null) {
  20.337 -            for (PropertyChangeListener listener : listeners) {
  20.338 -                listener.propertyChange(event);
  20.339 -            }
  20.340 -        }
  20.341 -    }
  20.342 -
  20.343 -    /**
  20.344 -     * Reports a bound indexed property update to listeners
  20.345 -     * that have been registered to track updates of
  20.346 -     * all properties or a property with the specified name.
  20.347 -     * <p>
  20.348 -     * No event is fired if old and new values are equal and non-null.
  20.349 -     * <p>
  20.350 -     * This is merely a convenience wrapper around the more general
  20.351 -     * {@link #firePropertyChange(PropertyChangeEvent)} method.
  20.352 -     *
  20.353 -     * @param propertyName  the programmatic name of the property that was changed
  20.354 -     * @param index         the index of the property element that was changed
  20.355 -     * @param oldValue      the old value of the property
  20.356 -     * @param newValue      the new value of the property
  20.357 -     * @since 1.5
  20.358 -     */
  20.359 -    public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) {
  20.360 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  20.361 -            firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index));
  20.362 -        }
  20.363 -    }
  20.364 -
  20.365 -    /**
  20.366 -     * Reports an integer bound indexed property update to listeners
  20.367 -     * that have been registered to track updates of
  20.368 -     * all properties or a property with the specified name.
  20.369 -     * <p>
  20.370 -     * No event is fired if old and new values are equal.
  20.371 -     * <p>
  20.372 -     * This is merely a convenience wrapper around the more general
  20.373 -     * {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
  20.374 -     *
  20.375 -     * @param propertyName  the programmatic name of the property that was changed
  20.376 -     * @param index         the index of the property element that was changed
  20.377 -     * @param oldValue      the old value of the property
  20.378 -     * @param newValue      the new value of the property
  20.379 -     * @since 1.5
  20.380 -     */
  20.381 -    public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue) {
  20.382 -        if (oldValue != newValue) {
  20.383 -            fireIndexedPropertyChange(propertyName, index, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  20.384 -        }
  20.385 -    }
  20.386 -
  20.387 -    /**
  20.388 -     * Reports a boolean bound indexed property update to listeners
  20.389 -     * that have been registered to track updates of
  20.390 -     * all properties or a property with the specified name.
  20.391 -     * <p>
  20.392 -     * No event is fired if old and new values are equal.
  20.393 -     * <p>
  20.394 -     * This is merely a convenience wrapper around the more general
  20.395 -     * {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
  20.396 -     *
  20.397 -     * @param propertyName  the programmatic name of the property that was changed
  20.398 -     * @param index         the index of the property element that was changed
  20.399 -     * @param oldValue      the old value of the property
  20.400 -     * @param newValue      the new value of the property
  20.401 -     * @since 1.5
  20.402 -     */
  20.403 -    public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue) {
  20.404 -        if (oldValue != newValue) {
  20.405 -            fireIndexedPropertyChange(propertyName, index, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  20.406 -        }
  20.407 -    }
  20.408 -
  20.409 -    /**
  20.410 -     * Check if there are any listeners for a specific property, including
  20.411 -     * those registered on all properties.  If <code>propertyName</code>
  20.412 -     * is null, only check for listeners registered on all properties.
  20.413 -     *
  20.414 -     * @param propertyName  the property name.
  20.415 -     * @return true if there are one or more listeners for the given property
  20.416 -     */
  20.417 -    public boolean hasListeners(String propertyName) {
  20.418 -        return this.map.hasListeners(propertyName);
  20.419 -    }
  20.420 -
  20.421 -    /**
  20.422 -     * @serialData Null terminated list of <code>PropertyChangeListeners</code>.
  20.423 -     * <p>
  20.424 -     * At serialization time we skip non-serializable listeners and
  20.425 -     * only serialize the serializable listeners.
  20.426 -     */
  20.427 -    private void writeObject(ObjectOutputStream s) throws IOException {
  20.428 -        Hashtable<String, PropertyChangeSupport> children = null;
  20.429 -        PropertyChangeListener[] listeners = null;
  20.430 -        synchronized (this.map) {
  20.431 -            for (Entry<String, PropertyChangeListener[]> entry : this.map.getEntries()) {
  20.432 -                String property = entry.getKey();
  20.433 -                if (property == null) {
  20.434 -                    listeners = entry.getValue();
  20.435 -                } else {
  20.436 -                    if (children == null) {
  20.437 -                        children = new Hashtable<String, PropertyChangeSupport>();
  20.438 -                    }
  20.439 -                    PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
  20.440 -                    pcs.map.set(null, entry.getValue());
  20.441 -                    children.put(property, pcs);
  20.442 -                }
  20.443 -            }
  20.444 -        }
  20.445 -        ObjectOutputStream.PutField fields = s.putFields();
  20.446 -        fields.put("children", children);
  20.447 -        fields.put("source", this.source);
  20.448 -        fields.put("propertyChangeSupportSerializedDataVersion", 2);
  20.449 -        s.writeFields();
  20.450 -
  20.451 -        if (listeners != null) {
  20.452 -            for (PropertyChangeListener l : listeners) {
  20.453 -                if (l instanceof Serializable) {
  20.454 -                    s.writeObject(l);
  20.455 -                }
  20.456 -            }
  20.457 -        }
  20.458 -        s.writeObject(null);
  20.459 -    }
  20.460 -
  20.461 -    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
  20.462 -        this.map = new PropertyChangeListenerMap();
  20.463 -
  20.464 -        ObjectInputStream.GetField fields = s.readFields();
  20.465 -
  20.466 -        Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
  20.467 -        this.source = fields.get("source", null);
  20.468 -        fields.get("propertyChangeSupportSerializedDataVersion", 2);
  20.469 -
  20.470 -        Object listenerOrNull;
  20.471 -        while (null != (listenerOrNull = s.readObject())) {
  20.472 -            this.map.add(null, (PropertyChangeListener)listenerOrNull);
  20.473 -        }
  20.474 -        if (children != null) {
  20.475 -            for (Entry<String, PropertyChangeSupport> entry : children.entrySet()) {
  20.476 -                for (PropertyChangeListener listener : entry.getValue().getPropertyChangeListeners()) {
  20.477 -                    this.map.add(entry.getKey(), listener);
  20.478 -                }
  20.479 -            }
  20.480 -        }
  20.481 -    }
  20.482 -
  20.483 -    /**
  20.484 -     * The object to be provided as the "source" for any generated events.
  20.485 -     */
  20.486 -    private Object source;
  20.487 -
  20.488 -    /**
  20.489 -     * @serialField children                                   Hashtable
  20.490 -     * @serialField source                                     Object
  20.491 -     * @serialField propertyChangeSupportSerializedDataVersion int
  20.492 -     */
  20.493 -    private static final ObjectStreamField[] serialPersistentFields = {
  20.494 -            new ObjectStreamField("children", Hashtable.class),
  20.495 -            new ObjectStreamField("source", Object.class),
  20.496 -            new ObjectStreamField("propertyChangeSupportSerializedDataVersion", Integer.TYPE)
  20.497 -    };
  20.498 -
  20.499 -    /**
  20.500 -     * Serialization version ID, so we're compatible with JDK 1.1
  20.501 -     */
  20.502 -    static final long serialVersionUID = 6401253773779951803L;
  20.503 -
  20.504 -    /**
  20.505 -     * This is a {@link ChangeListenerMap ChangeListenerMap} implementation
  20.506 -     * that works with {@link PropertyChangeListener PropertyChangeListener} objects.
  20.507 -     */
  20.508 -    private static final class PropertyChangeListenerMap extends ChangeListenerMap<PropertyChangeListener> {
  20.509 -        private static final PropertyChangeListener[] EMPTY = {};
  20.510 -
  20.511 -        /**
  20.512 -         * Creates an array of {@link PropertyChangeListener PropertyChangeListener} objects.
  20.513 -         * This method uses the same instance of the empty array
  20.514 -         * when {@code length} equals {@code 0}.
  20.515 -         *
  20.516 -         * @param length  the array length
  20.517 -         * @return        an array with specified length
  20.518 -         */
  20.519 -        @Override
  20.520 -        protected PropertyChangeListener[] newArray(int length) {
  20.521 -            return (0 < length)
  20.522 -                    ? new PropertyChangeListener[length]
  20.523 -                    : EMPTY;
  20.524 -        }
  20.525 -
  20.526 -        /**
  20.527 -         * Creates a {@link PropertyChangeListenerProxy PropertyChangeListenerProxy}
  20.528 -         * object for the specified property.
  20.529 -         *
  20.530 -         * @param name      the name of the property to listen on
  20.531 -         * @param listener  the listener to process events
  20.532 -         * @return          a {@code PropertyChangeListenerProxy} object
  20.533 -         */
  20.534 -        @Override
  20.535 -        protected PropertyChangeListener newProxy(String name, PropertyChangeListener listener) {
  20.536 -            return new PropertyChangeListenerProxy(name, listener);
  20.537 -        }
  20.538 -    }
  20.539 -}
    21.1 --- a/emul/compact/src/main/java/java/beans/PropertyVetoException.java	Fri Mar 22 16:59:47 2013 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,64 +0,0 @@
    21.4 -/*
    21.5 - * Copyright (c) 1996, 2009, 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.beans;
   21.30 -
   21.31 -
   21.32 -/**
   21.33 - * A PropertyVetoException is thrown when a proposed change to a
   21.34 - * property represents an unacceptable value.
   21.35 - */
   21.36 -
   21.37 -public
   21.38 -class PropertyVetoException extends Exception {
   21.39 -    private static final long serialVersionUID = 129596057694162164L;
   21.40 -
   21.41 -    /**
   21.42 -     * Constructs a <code>PropertyVetoException</code> with a
   21.43 -     * detailed message.
   21.44 -     *
   21.45 -     * @param mess Descriptive message
   21.46 -     * @param evt A PropertyChangeEvent describing the vetoed change.
   21.47 -     */
   21.48 -    public PropertyVetoException(String mess, PropertyChangeEvent evt) {
   21.49 -        super(mess);
   21.50 -        this.evt = evt;
   21.51 -    }
   21.52 -
   21.53 -     /**
   21.54 -     * Gets the vetoed <code>PropertyChangeEvent</code>.
   21.55 -     *
   21.56 -     * @return A PropertyChangeEvent describing the vetoed change.
   21.57 -     */
   21.58 -    public PropertyChangeEvent getPropertyChangeEvent() {
   21.59 -        return evt;
   21.60 -    }
   21.61 -
   21.62 -    /**
   21.63 -     * A PropertyChangeEvent describing the vetoed change.
   21.64 -     * @serial
   21.65 -     */
   21.66 -    private PropertyChangeEvent evt;
   21.67 -}
    22.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeListener.java	Fri Mar 22 16:59:47 2013 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,44 +0,0 @@
    22.4 -/*
    22.5 - * Copyright (c) 1996, 1997, 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.beans;
   22.30 -
   22.31 -/**
   22.32 - * A VetoableChange event gets fired whenever a bean changes a "constrained"
   22.33 - * property.  You can register a VetoableChangeListener with a source bean
   22.34 - * so as to be notified of any constrained property updates.
   22.35 - */
   22.36 -public interface VetoableChangeListener extends java.util.EventListener {
   22.37 -    /**
   22.38 -     * This method gets called when a constrained property is changed.
   22.39 -     *
   22.40 -     * @param     evt a <code>PropertyChangeEvent</code> object describing the
   22.41 -     *                event source and the property that has changed.
   22.42 -     * @exception PropertyVetoException if the recipient wishes the property
   22.43 -     *              change to be rolled back.
   22.44 -     */
   22.45 -    void vetoableChange(PropertyChangeEvent evt)
   22.46 -                                throws PropertyVetoException;
   22.47 -}
    23.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeListenerProxy.java	Fri Mar 22 16:59:47 2013 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,84 +0,0 @@
    23.4 -/*
    23.5 - * Copyright (c) 2000, 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.beans;
   23.30 -
   23.31 -import java.util.EventListenerProxy;
   23.32 -
   23.33 -/**
   23.34 - * A class which extends the {@code EventListenerProxy}
   23.35 - * specifically for adding a {@code VetoableChangeListener}
   23.36 - * with a "constrained" property.
   23.37 - * Instances of this class can be added
   23.38 - * as {@code VetoableChangeListener}s to a bean
   23.39 - * which supports firing vetoable change events.
   23.40 - * <p>
   23.41 - * If the object has a {@code getVetoableChangeListeners} method
   23.42 - * then the array returned could be a mixture of {@code VetoableChangeListener}
   23.43 - * and {@code VetoableChangeListenerProxy} objects.
   23.44 - *
   23.45 - * @see java.util.EventListenerProxy
   23.46 - * @see VetoableChangeSupport#getVetoableChangeListeners
   23.47 - * @since 1.4
   23.48 - */
   23.49 -public class VetoableChangeListenerProxy
   23.50 -        extends EventListenerProxy<VetoableChangeListener>
   23.51 -        implements VetoableChangeListener {
   23.52 -
   23.53 -    private final String propertyName;
   23.54 -
   23.55 -    /**
   23.56 -     * Constructor which binds the {@code VetoableChangeListener}
   23.57 -     * to a specific property.
   23.58 -     *
   23.59 -     * @param propertyName  the name of the property to listen on
   23.60 -     * @param listener      the listener object
   23.61 -     */
   23.62 -    public VetoableChangeListenerProxy(String propertyName, VetoableChangeListener listener) {
   23.63 -        super(listener);
   23.64 -        this.propertyName = propertyName;
   23.65 -    }
   23.66 -
   23.67 -    /**
   23.68 -    * Forwards the property change event to the listener delegate.
   23.69 -    *
   23.70 -    * @param event  the property change event
   23.71 -    *
   23.72 -    * @exception PropertyVetoException if the recipient wishes the property
   23.73 -    *                                  change to be rolled back
   23.74 -    */
   23.75 -    public void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException{
   23.76 -        getListener().vetoableChange(event);
   23.77 -    }
   23.78 -
   23.79 -    /**
   23.80 -     * Returns the name of the named property associated with the listener.
   23.81 -     *
   23.82 -     * @return the name of the named property associated with the listener
   23.83 -     */
   23.84 -    public String getPropertyName() {
   23.85 -        return this.propertyName;
   23.86 -    }
   23.87 -}
    24.1 --- a/emul/compact/src/main/java/java/beans/VetoableChangeSupport.java	Fri Mar 22 16:59:47 2013 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,526 +0,0 @@
    24.4 -/*
    24.5 - * Copyright (c) 1996, 2011, 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 -package java.beans;
   24.29 -
   24.30 -import java.io.Serializable;
   24.31 -import java.io.ObjectStreamField;
   24.32 -import java.io.ObjectOutputStream;
   24.33 -import java.io.ObjectInputStream;
   24.34 -import java.io.IOException;
   24.35 -import java.util.Hashtable;
   24.36 -import java.util.Map.Entry;
   24.37 -import org.apidesign.bck2brwsr.emul.lang.System;
   24.38 -
   24.39 -/**
   24.40 - * This is a utility class that can be used by beans that support constrained
   24.41 - * properties.  It manages a list of listeners and dispatches
   24.42 - * {@link PropertyChangeEvent}s to them.  You can use an instance of this class
   24.43 - * as a member field of your bean and delegate these types of work to it.
   24.44 - * The {@link VetoableChangeListener} can be registered for all properties
   24.45 - * or for a property specified by name.
   24.46 - * <p>
   24.47 - * Here is an example of {@code VetoableChangeSupport} usage that follows
   24.48 - * the rules and recommendations laid out in the JavaBeans&trade; specification:
   24.49 - * <pre>
   24.50 - * public class MyBean {
   24.51 - *     private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
   24.52 - *
   24.53 - *     public void addVetoableChangeListener(VetoableChangeListener listener) {
   24.54 - *         this.vcs.addVetoableChangeListener(listener);
   24.55 - *     }
   24.56 - *
   24.57 - *     public void removeVetoableChangeListener(VetoableChangeListener listener) {
   24.58 - *         this.vcs.removeVetoableChangeListener(listener);
   24.59 - *     }
   24.60 - *
   24.61 - *     private String value;
   24.62 - *
   24.63 - *     public String getValue() {
   24.64 - *         return this.value;
   24.65 - *     }
   24.66 - *
   24.67 - *     public void setValue(String newValue) throws PropertyVetoException {
   24.68 - *         String oldValue = this.value;
   24.69 - *         this.vcs.fireVetoableChange("value", oldValue, newValue);
   24.70 - *         this.value = newValue;
   24.71 - *     }
   24.72 - *
   24.73 - *     [...]
   24.74 - * }
   24.75 - * </pre>
   24.76 - * <p>
   24.77 - * A {@code VetoableChangeSupport} instance is thread-safe.
   24.78 - * <p>
   24.79 - * This class is serializable.  When it is serialized it will save
   24.80 - * (and restore) any listeners that are themselves serializable.  Any
   24.81 - * non-serializable listeners will be skipped during serialization.
   24.82 - *
   24.83 - * @see PropertyChangeSupport
   24.84 - */
   24.85 -public class VetoableChangeSupport implements Serializable {
   24.86 -    private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
   24.87 -
   24.88 -    /**
   24.89 -     * Constructs a <code>VetoableChangeSupport</code> object.
   24.90 -     *
   24.91 -     * @param sourceBean  The bean to be given as the source for any events.
   24.92 -     */
   24.93 -    public VetoableChangeSupport(Object sourceBean) {
   24.94 -        if (sourceBean == null) {
   24.95 -            throw new NullPointerException();
   24.96 -        }
   24.97 -        source = sourceBean;
   24.98 -    }
   24.99 -
  24.100 -    /**
  24.101 -     * Add a VetoableChangeListener to the listener list.
  24.102 -     * The listener is registered for all properties.
  24.103 -     * The same listener object may be added more than once, and will be called
  24.104 -     * as many times as it is added.
  24.105 -     * If <code>listener</code> is null, no exception is thrown and no action
  24.106 -     * is taken.
  24.107 -     *
  24.108 -     * @param listener  The VetoableChangeListener to be added
  24.109 -     */
  24.110 -    public void addVetoableChangeListener(VetoableChangeListener listener) {
  24.111 -        if (listener == null) {
  24.112 -            return;
  24.113 -        }
  24.114 -        if (listener instanceof VetoableChangeListenerProxy) {
  24.115 -            VetoableChangeListenerProxy proxy =
  24.116 -                    (VetoableChangeListenerProxy)listener;
  24.117 -            // Call two argument add method.
  24.118 -            addVetoableChangeListener(proxy.getPropertyName(),
  24.119 -                                      proxy.getListener());
  24.120 -        } else {
  24.121 -            this.map.add(null, listener);
  24.122 -        }
  24.123 -    }
  24.124 -
  24.125 -    /**
  24.126 -     * Remove a VetoableChangeListener from the listener list.
  24.127 -     * This removes a VetoableChangeListener that was registered
  24.128 -     * for all properties.
  24.129 -     * If <code>listener</code> was added more than once to the same event
  24.130 -     * source, it will be notified one less time after being removed.
  24.131 -     * If <code>listener</code> is null, or was never added, no exception is
  24.132 -     * thrown and no action is taken.
  24.133 -     *
  24.134 -     * @param listener  The VetoableChangeListener to be removed
  24.135 -     */
  24.136 -    public void removeVetoableChangeListener(VetoableChangeListener listener) {
  24.137 -        if (listener == null) {
  24.138 -            return;
  24.139 -        }
  24.140 -        if (listener instanceof VetoableChangeListenerProxy) {
  24.141 -            VetoableChangeListenerProxy proxy =
  24.142 -                    (VetoableChangeListenerProxy)listener;
  24.143 -            // Call two argument remove method.
  24.144 -            removeVetoableChangeListener(proxy.getPropertyName(),
  24.145 -                                         proxy.getListener());
  24.146 -        } else {
  24.147 -            this.map.remove(null, listener);
  24.148 -        }
  24.149 -    }
  24.150 -
  24.151 -    /**
  24.152 -     * Returns an array of all the listeners that were added to the
  24.153 -     * VetoableChangeSupport object with addVetoableChangeListener().
  24.154 -     * <p>
  24.155 -     * If some listeners have been added with a named property, then
  24.156 -     * the returned array will be a mixture of VetoableChangeListeners
  24.157 -     * and <code>VetoableChangeListenerProxy</code>s. If the calling
  24.158 -     * method is interested in distinguishing the listeners then it must
  24.159 -     * test each element to see if it's a
  24.160 -     * <code>VetoableChangeListenerProxy</code>, perform the cast, and examine
  24.161 -     * the parameter.
  24.162 -     *
  24.163 -     * <pre>
  24.164 -     * VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
  24.165 -     * for (int i = 0; i < listeners.length; i++) {
  24.166 -     *        if (listeners[i] instanceof VetoableChangeListenerProxy) {
  24.167 -     *     VetoableChangeListenerProxy proxy =
  24.168 -     *                    (VetoableChangeListenerProxy)listeners[i];
  24.169 -     *     if (proxy.getPropertyName().equals("foo")) {
  24.170 -     *       // proxy is a VetoableChangeListener which was associated
  24.171 -     *       // with the property named "foo"
  24.172 -     *     }
  24.173 -     *   }
  24.174 -     * }
  24.175 -     *</pre>
  24.176 -     *
  24.177 -     * @see VetoableChangeListenerProxy
  24.178 -     * @return all of the <code>VetoableChangeListeners</code> added or an
  24.179 -     *         empty array if no listeners have been added
  24.180 -     * @since 1.4
  24.181 -     */
  24.182 -    public VetoableChangeListener[] getVetoableChangeListeners(){
  24.183 -        return this.map.getListeners();
  24.184 -    }
  24.185 -
  24.186 -    /**
  24.187 -     * Add a VetoableChangeListener for a specific property.  The listener
  24.188 -     * will be invoked only when a call on fireVetoableChange names that
  24.189 -     * specific property.
  24.190 -     * The same listener object may be added more than once.  For each
  24.191 -     * property,  the listener will be invoked the number of times it was added
  24.192 -     * for that property.
  24.193 -     * If <code>propertyName</code> or <code>listener</code> is null, no
  24.194 -     * exception is thrown and no action is taken.
  24.195 -     *
  24.196 -     * @param propertyName  The name of the property to listen on.
  24.197 -     * @param listener  The VetoableChangeListener to be added
  24.198 -     */
  24.199 -    public void addVetoableChangeListener(
  24.200 -                                String propertyName,
  24.201 -                VetoableChangeListener listener) {
  24.202 -        if (listener == null || propertyName == null) {
  24.203 -            return;
  24.204 -        }
  24.205 -        listener = this.map.extract(listener);
  24.206 -        if (listener != null) {
  24.207 -            this.map.add(propertyName, listener);
  24.208 -        }
  24.209 -    }
  24.210 -
  24.211 -    /**
  24.212 -     * Remove a VetoableChangeListener for a specific property.
  24.213 -     * If <code>listener</code> was added more than once to the same event
  24.214 -     * source for the specified property, it will be notified one less time
  24.215 -     * after being removed.
  24.216 -     * If <code>propertyName</code> is null, no exception is thrown and no
  24.217 -     * action is taken.
  24.218 -     * If <code>listener</code> is null, or was never added for the specified
  24.219 -     * property, no exception is thrown and no action is taken.
  24.220 -     *
  24.221 -     * @param propertyName  The name of the property that was listened on.
  24.222 -     * @param listener  The VetoableChangeListener to be removed
  24.223 -     */
  24.224 -    public void removeVetoableChangeListener(
  24.225 -                                String propertyName,
  24.226 -                VetoableChangeListener listener) {
  24.227 -        if (listener == null || propertyName == null) {
  24.228 -            return;
  24.229 -        }
  24.230 -        listener = this.map.extract(listener);
  24.231 -        if (listener != null) {
  24.232 -            this.map.remove(propertyName, listener);
  24.233 -        }
  24.234 -    }
  24.235 -
  24.236 -    /**
  24.237 -     * Returns an array of all the listeners which have been associated
  24.238 -     * with the named property.
  24.239 -     *
  24.240 -     * @param propertyName  The name of the property being listened to
  24.241 -     * @return all the <code>VetoableChangeListeners</code> associated with
  24.242 -     *         the named property.  If no such listeners have been added,
  24.243 -     *         or if <code>propertyName</code> is null, an empty array is
  24.244 -     *         returned.
  24.245 -     * @since 1.4
  24.246 -     */
  24.247 -    public VetoableChangeListener[] getVetoableChangeListeners(String propertyName) {
  24.248 -        return this.map.getListeners(propertyName);
  24.249 -    }
  24.250 -
  24.251 -    /**
  24.252 -     * Reports a constrained property update to listeners
  24.253 -     * that have been registered to track updates of
  24.254 -     * all properties or a property with the specified name.
  24.255 -     * <p>
  24.256 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  24.257 -     * If one of the listeners vetoes the update, this method passes
  24.258 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  24.259 -     * to all listeners that already confirmed this update
  24.260 -     * and throws the {@code PropertyVetoException} again.
  24.261 -     * <p>
  24.262 -     * No event is fired if old and new values are equal and non-null.
  24.263 -     * <p>
  24.264 -     * This is merely a convenience wrapper around the more general
  24.265 -     * {@link #fireVetoableChange(PropertyChangeEvent)} method.
  24.266 -     *
  24.267 -     * @param propertyName  the programmatic name of the property that is about to change
  24.268 -     * @param oldValue      the old value of the property
  24.269 -     * @param newValue      the new value of the property
  24.270 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  24.271 -     */
  24.272 -    public void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
  24.273 -            throws PropertyVetoException {
  24.274 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  24.275 -            fireVetoableChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
  24.276 -        }
  24.277 -    }
  24.278 -
  24.279 -    /**
  24.280 -     * Reports an integer constrained property update to listeners
  24.281 -     * that have been registered to track updates of
  24.282 -     * all properties or a property with the specified name.
  24.283 -     * <p>
  24.284 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  24.285 -     * If one of the listeners vetoes the update, this method passes
  24.286 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  24.287 -     * to all listeners that already confirmed this update
  24.288 -     * and throws the {@code PropertyVetoException} again.
  24.289 -     * <p>
  24.290 -     * No event is fired if old and new values are equal.
  24.291 -     * <p>
  24.292 -     * This is merely a convenience wrapper around the more general
  24.293 -     * {@link #fireVetoableChange(String, Object, Object)} method.
  24.294 -     *
  24.295 -     * @param propertyName  the programmatic name of the property that is about to change
  24.296 -     * @param oldValue      the old value of the property
  24.297 -     * @param newValue      the new value of the property
  24.298 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  24.299 -     */
  24.300 -    public void fireVetoableChange(String propertyName, int oldValue, int newValue)
  24.301 -            throws PropertyVetoException {
  24.302 -        if (oldValue != newValue) {
  24.303 -            fireVetoableChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
  24.304 -        }
  24.305 -    }
  24.306 -
  24.307 -    /**
  24.308 -     * Reports a boolean constrained property update to listeners
  24.309 -     * that have been registered to track updates of
  24.310 -     * all properties or a property with the specified name.
  24.311 -     * <p>
  24.312 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  24.313 -     * If one of the listeners vetoes the update, this method passes
  24.314 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  24.315 -     * to all listeners that already confirmed this update
  24.316 -     * and throws the {@code PropertyVetoException} again.
  24.317 -     * <p>
  24.318 -     * No event is fired if old and new values are equal.
  24.319 -     * <p>
  24.320 -     * This is merely a convenience wrapper around the more general
  24.321 -     * {@link #fireVetoableChange(String, Object, Object)} method.
  24.322 -     *
  24.323 -     * @param propertyName  the programmatic name of the property that is about to change
  24.324 -     * @param oldValue      the old value of the property
  24.325 -     * @param newValue      the new value of the property
  24.326 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  24.327 -     */
  24.328 -    public void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue)
  24.329 -            throws PropertyVetoException {
  24.330 -        if (oldValue != newValue) {
  24.331 -            fireVetoableChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
  24.332 -        }
  24.333 -    }
  24.334 -
  24.335 -    /**
  24.336 -     * Fires a property change event to listeners
  24.337 -     * that have been registered to track updates of
  24.338 -     * all properties or a property with the specified name.
  24.339 -     * <p>
  24.340 -     * Any listener can throw a {@code PropertyVetoException} to veto the update.
  24.341 -     * If one of the listeners vetoes the update, this method passes
  24.342 -     * a new "undo" {@code PropertyChangeEvent} that reverts to the old value
  24.343 -     * to all listeners that already confirmed this update
  24.344 -     * and throws the {@code PropertyVetoException} again.
  24.345 -     * <p>
  24.346 -     * No event is fired if the given event's old and new values are equal and non-null.
  24.347 -     *
  24.348 -     * @param event  the {@code PropertyChangeEvent} to be fired
  24.349 -     * @throws PropertyVetoException if one of listeners vetoes the property update
  24.350 -     */
  24.351 -    public void fireVetoableChange(PropertyChangeEvent event)
  24.352 -            throws PropertyVetoException {
  24.353 -        Object oldValue = event.getOldValue();
  24.354 -        Object newValue = event.getNewValue();
  24.355 -        if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
  24.356 -            String name = event.getPropertyName();
  24.357 -
  24.358 -            VetoableChangeListener[] common = this.map.get(null);
  24.359 -            VetoableChangeListener[] named = (name != null)
  24.360 -                        ? this.map.get(name)
  24.361 -                        : null;
  24.362 -
  24.363 -            VetoableChangeListener[] listeners;
  24.364 -            if (common == null) {
  24.365 -                listeners = named;
  24.366 -            }
  24.367 -            else if (named == null) {
  24.368 -                listeners = common;
  24.369 -            }
  24.370 -            else {
  24.371 -                listeners = new VetoableChangeListener[common.length + named.length];
  24.372 -                System.arraycopy(common, 0, listeners, 0, common.length);
  24.373 -                System.arraycopy(named, 0, listeners, common.length, named.length);
  24.374 -            }
  24.375 -            if (listeners != null) {
  24.376 -                int current = 0;
  24.377 -                try {
  24.378 -                    while (current < listeners.length) {
  24.379 -                        listeners[current].vetoableChange(event);
  24.380 -                        current++;
  24.381 -                    }
  24.382 -                }
  24.383 -                catch (PropertyVetoException veto) {
  24.384 -                    event = new PropertyChangeEvent(this.source, name, newValue, oldValue);
  24.385 -                    for (int i = 0; i < current; i++) {
  24.386 -                        try {
  24.387 -                            listeners[i].vetoableChange(event);
  24.388 -                        }
  24.389 -                        catch (PropertyVetoException exception) {
  24.390 -                            // ignore exceptions that occur during rolling back
  24.391 -                        }
  24.392 -                    }
  24.393 -                    throw veto; // rethrow the veto exception
  24.394 -                }
  24.395 -            }
  24.396 -        }
  24.397 -    }
  24.398 -
  24.399 -    /**
  24.400 -     * Check if there are any listeners for a specific property, including
  24.401 -     * those registered on all properties.  If <code>propertyName</code>
  24.402 -     * is null, only check for listeners registered on all properties.
  24.403 -     *
  24.404 -     * @param propertyName  the property name.
  24.405 -     * @return true if there are one or more listeners for the given property
  24.406 -     */
  24.407 -    public boolean hasListeners(String propertyName) {
  24.408 -        return this.map.hasListeners(propertyName);
  24.409 -    }
  24.410 -
  24.411 -    /**
  24.412 -     * @serialData Null terminated list of <code>VetoableChangeListeners</code>.
  24.413 -     * <p>
  24.414 -     * At serialization time we skip non-serializable listeners and
  24.415 -     * only serialize the serializable listeners.
  24.416 -     */
  24.417 -    private void writeObject(ObjectOutputStream s) throws IOException {
  24.418 -        Hashtable<String, VetoableChangeSupport> children = null;
  24.419 -        VetoableChangeListener[] listeners = null;
  24.420 -        synchronized (this.map) {
  24.421 -            for (Entry<String, VetoableChangeListener[]> entry : this.map.getEntries()) {
  24.422 -                String property = entry.getKey();
  24.423 -                if (property == null) {
  24.424 -                    listeners = entry.getValue();
  24.425 -                } else {
  24.426 -                    if (children == null) {
  24.427 -                        children = new Hashtable<String, VetoableChangeSupport>();
  24.428 -                    }
  24.429 -                    VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
  24.430 -                    vcs.map.set(null, entry.getValue());
  24.431 -                    children.put(property, vcs);
  24.432 -                }
  24.433 -            }
  24.434 -        }
  24.435 -        ObjectOutputStream.PutField fields = s.putFields();
  24.436 -        fields.put("children", children);
  24.437 -        fields.put("source", this.source);
  24.438 -        fields.put("vetoableChangeSupportSerializedDataVersion", 2);
  24.439 -        s.writeFields();
  24.440 -
  24.441 -        if (listeners != null) {
  24.442 -            for (VetoableChangeListener l : listeners) {
  24.443 -                if (l instanceof Serializable) {
  24.444 -                    s.writeObject(l);
  24.445 -                }
  24.446 -            }
  24.447 -        }
  24.448 -        s.writeObject(null);
  24.449 -    }
  24.450 -
  24.451 -    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
  24.452 -        this.map = new VetoableChangeListenerMap();
  24.453 -
  24.454 -        ObjectInputStream.GetField fields = s.readFields();
  24.455 -
  24.456 -        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>) fields.get("children", null);
  24.457 -        this.source = fields.get("source", null);
  24.458 -        fields.get("vetoableChangeSupportSerializedDataVersion", 2);
  24.459 -
  24.460 -        Object listenerOrNull;
  24.461 -        while (null != (listenerOrNull = s.readObject())) {
  24.462 -            this.map.add(null, (VetoableChangeListener)listenerOrNull);
  24.463 -        }
  24.464 -        if (children != null) {
  24.465 -            for (Entry<String, VetoableChangeSupport> entry : children.entrySet()) {
  24.466 -                for (VetoableChangeListener listener : entry.getValue().getVetoableChangeListeners()) {
  24.467 -                    this.map.add(entry.getKey(), listener);
  24.468 -                }
  24.469 -            }
  24.470 -        }
  24.471 -    }
  24.472 -
  24.473 -    /**
  24.474 -     * The object to be provided as the "source" for any generated events.
  24.475 -     */
  24.476 -    private Object source;
  24.477 -
  24.478 -    /**
  24.479 -     * @serialField children                                   Hashtable
  24.480 -     * @serialField source                                     Object
  24.481 -     * @serialField vetoableChangeSupportSerializedDataVersion int
  24.482 -     */
  24.483 -    private static final ObjectStreamField[] serialPersistentFields = {
  24.484 -            new ObjectStreamField("children", Hashtable.class),
  24.485 -            new ObjectStreamField("source", Object.class),
  24.486 -            new ObjectStreamField("vetoableChangeSupportSerializedDataVersion", Integer.TYPE)
  24.487 -    };
  24.488 -
  24.489 -    /**
  24.490 -     * Serialization version ID, so we're compatible with JDK 1.1
  24.491 -     */
  24.492 -    static final long serialVersionUID = -5090210921595982017L;
  24.493 -
  24.494 -    /**
  24.495 -     * This is a {@link ChangeListenerMap ChangeListenerMap} implementation
  24.496 -     * that works with {@link VetoableChangeListener VetoableChangeListener} objects.
  24.497 -     */
  24.498 -    private static final class VetoableChangeListenerMap extends ChangeListenerMap<VetoableChangeListener> {
  24.499 -        private static final VetoableChangeListener[] EMPTY = {};
  24.500 -
  24.501 -        /**
  24.502 -         * Creates an array of {@link VetoableChangeListener VetoableChangeListener} objects.
  24.503 -         * This method uses the same instance of the empty array
  24.504 -         * when {@code length} equals {@code 0}.
  24.505 -         *
  24.506 -         * @param length  the array length
  24.507 -         * @return        an array with specified length
  24.508 -         */
  24.509 -        @Override
  24.510 -        protected VetoableChangeListener[] newArray(int length) {
  24.511 -            return (0 < length)
  24.512 -                    ? new VetoableChangeListener[length]
  24.513 -                    : EMPTY;
  24.514 -        }
  24.515 -
  24.516 -        /**
  24.517 -         * Creates a {@link VetoableChangeListenerProxy VetoableChangeListenerProxy}
  24.518 -         * object for the specified property.
  24.519 -         *
  24.520 -         * @param name      the name of the property to listen on
  24.521 -         * @param listener  the listener to process events
  24.522 -         * @return          a {@code VetoableChangeListenerProxy} object
  24.523 -         */
  24.524 -        @Override
  24.525 -        protected VetoableChangeListener newProxy(String name, VetoableChangeListener listener) {
  24.526 -            return new VetoableChangeListenerProxy(name, listener);
  24.527 -        }
  24.528 -    }
  24.529 -}
    25.1 --- a/emul/compact/src/main/java/java/io/Bits.java	Fri Mar 22 16:59:47 2013 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,123 +0,0 @@
    25.4 -/*
    25.5 - * Copyright (c) 2001, 2010, 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 -/**
   25.32 - * Utility methods for packing/unpacking primitive values in/out of byte arrays
   25.33 - * using big-endian byte ordering.
   25.34 - */
   25.35 -class Bits {
   25.36 -
   25.37 -    /*
   25.38 -     * Methods for unpacking primitive values from byte arrays starting at
   25.39 -     * given offsets.
   25.40 -     */
   25.41 -
   25.42 -    static boolean getBoolean(byte[] b, int off) {
   25.43 -        return b[off] != 0;
   25.44 -    }
   25.45 -
   25.46 -    static char getChar(byte[] b, int off) {
   25.47 -        return (char) ((b[off + 1] & 0xFF) +
   25.48 -                       (b[off] << 8));
   25.49 -    }
   25.50 -
   25.51 -    static short getShort(byte[] b, int off) {
   25.52 -        return (short) ((b[off + 1] & 0xFF) +
   25.53 -                        (b[off] << 8));
   25.54 -    }
   25.55 -
   25.56 -    static int getInt(byte[] b, int off) {
   25.57 -        return ((b[off + 3] & 0xFF)      ) +
   25.58 -               ((b[off + 2] & 0xFF) <<  8) +
   25.59 -               ((b[off + 1] & 0xFF) << 16) +
   25.60 -               ((b[off    ]       ) << 24);
   25.61 -    }
   25.62 -
   25.63 -    static float getFloat(byte[] b, int off) {
   25.64 -        return Float.intBitsToFloat(getInt(b, off));
   25.65 -    }
   25.66 -
   25.67 -    static long getLong(byte[] b, int off) {
   25.68 -        return ((b[off + 7] & 0xFFL)      ) +
   25.69 -               ((b[off + 6] & 0xFFL) <<  8) +
   25.70 -               ((b[off + 5] & 0xFFL) << 16) +
   25.71 -               ((b[off + 4] & 0xFFL) << 24) +
   25.72 -               ((b[off + 3] & 0xFFL) << 32) +
   25.73 -               ((b[off + 2] & 0xFFL) << 40) +
   25.74 -               ((b[off + 1] & 0xFFL) << 48) +
   25.75 -               (((long) b[off])      << 56);
   25.76 -    }
   25.77 -
   25.78 -    static double getDouble(byte[] b, int off) {
   25.79 -        return Double.longBitsToDouble(getLong(b, off));
   25.80 -    }
   25.81 -
   25.82 -    /*
   25.83 -     * Methods for packing primitive values into byte arrays starting at given
   25.84 -     * offsets.
   25.85 -     */
   25.86 -
   25.87 -    static void putBoolean(byte[] b, int off, boolean val) {
   25.88 -        b[off] = (byte) (val ? 1 : 0);
   25.89 -    }
   25.90 -
   25.91 -    static void putChar(byte[] b, int off, char val) {
   25.92 -        b[off + 1] = (byte) (val      );
   25.93 -        b[off    ] = (byte) (val >>> 8);
   25.94 -    }
   25.95 -
   25.96 -    static void putShort(byte[] b, int off, short val) {
   25.97 -        b[off + 1] = (byte) (val      );
   25.98 -        b[off    ] = (byte) (val >>> 8);
   25.99 -    }
  25.100 -
  25.101 -    static void putInt(byte[] b, int off, int val) {
  25.102 -        b[off + 3] = (byte) (val       );
  25.103 -        b[off + 2] = (byte) (val >>>  8);
  25.104 -        b[off + 1] = (byte) (val >>> 16);
  25.105 -        b[off    ] = (byte) (val >>> 24);
  25.106 -    }
  25.107 -
  25.108 -    static void putFloat(byte[] b, int off, float val) {
  25.109 -        putInt(b, off,  Float.floatToIntBits(val));
  25.110 -    }
  25.111 -
  25.112 -    static void putLong(byte[] b, int off, long val) {
  25.113 -        b[off + 7] = (byte) (val       );
  25.114 -        b[off + 6] = (byte) (val >>>  8);
  25.115 -        b[off + 5] = (byte) (val >>> 16);
  25.116 -        b[off + 4] = (byte) (val >>> 24);
  25.117 -        b[off + 3] = (byte) (val >>> 32);
  25.118 -        b[off + 2] = (byte) (val >>> 40);
  25.119 -        b[off + 1] = (byte) (val >>> 48);
  25.120 -        b[off    ] = (byte) (val >>> 56);
  25.121 -    }
  25.122 -
  25.123 -    static void putDouble(byte[] b, int off, double val) {
  25.124 -        putLong(b, off, Double.doubleToLongBits(val));
  25.125 -    }
  25.126 -}
    26.1 --- a/emul/compact/src/main/java/java/io/BufferedOutputStream.java	Fri Mar 22 16:59:47 2013 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,143 +0,0 @@
    26.4 -/*
    26.5 - * Copyright (c) 1994, 2003, 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 - * The class implements a buffered output stream. By setting up such
   26.33 - * an output stream, an application can write bytes to the underlying
   26.34 - * output stream without necessarily causing a call to the underlying
   26.35 - * system for each byte written.
   26.36 - *
   26.37 - * @author  Arthur van Hoff
   26.38 - * @since   JDK1.0
   26.39 - */
   26.40 -public
   26.41 -class BufferedOutputStream extends FilterOutputStream {
   26.42 -    /**
   26.43 -     * The internal buffer where data is stored.
   26.44 -     */
   26.45 -    protected byte buf[];
   26.46 -
   26.47 -    /**
   26.48 -     * The number of valid bytes in the buffer. This value is always
   26.49 -     * in the range <tt>0</tt> through <tt>buf.length</tt>; elements
   26.50 -     * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
   26.51 -     * byte data.
   26.52 -     */
   26.53 -    protected int count;
   26.54 -
   26.55 -    /**
   26.56 -     * Creates a new buffered output stream to write data to the
   26.57 -     * specified underlying output stream.
   26.58 -     *
   26.59 -     * @param   out   the underlying output stream.
   26.60 -     */
   26.61 -    public BufferedOutputStream(OutputStream out) {
   26.62 -        this(out, 8192);
   26.63 -    }
   26.64 -
   26.65 -    /**
   26.66 -     * Creates a new buffered output stream to write data to the
   26.67 -     * specified underlying output stream with the specified buffer
   26.68 -     * size.
   26.69 -     *
   26.70 -     * @param   out    the underlying output stream.
   26.71 -     * @param   size   the buffer size.
   26.72 -     * @exception IllegalArgumentException if size &lt;= 0.
   26.73 -     */
   26.74 -    public BufferedOutputStream(OutputStream out, int size) {
   26.75 -        super(out);
   26.76 -        if (size <= 0) {
   26.77 -            throw new IllegalArgumentException("Buffer size <= 0");
   26.78 -        }
   26.79 -        buf = new byte[size];
   26.80 -    }
   26.81 -
   26.82 -    /** Flush the internal buffer */
   26.83 -    private void flushBuffer() throws IOException {
   26.84 -        if (count > 0) {
   26.85 -            out.write(buf, 0, count);
   26.86 -            count = 0;
   26.87 -        }
   26.88 -    }
   26.89 -
   26.90 -    /**
   26.91 -     * Writes the specified byte to this buffered output stream.
   26.92 -     *
   26.93 -     * @param      b   the byte to be written.
   26.94 -     * @exception  IOException  if an I/O error occurs.
   26.95 -     */
   26.96 -    public synchronized void write(int b) throws IOException {
   26.97 -        if (count >= buf.length) {
   26.98 -            flushBuffer();
   26.99 -        }
  26.100 -        buf[count++] = (byte)b;
  26.101 -    }
  26.102 -
  26.103 -    /**
  26.104 -     * Writes <code>len</code> bytes from the specified byte array
  26.105 -     * starting at offset <code>off</code> to this buffered output stream.
  26.106 -     *
  26.107 -     * <p> Ordinarily this method stores bytes from the given array into this
  26.108 -     * stream's buffer, flushing the buffer to the underlying output stream as
  26.109 -     * needed.  If the requested length is at least as large as this stream's
  26.110 -     * buffer, however, then this method will flush the buffer and write the
  26.111 -     * bytes directly to the underlying output stream.  Thus redundant
  26.112 -     * <code>BufferedOutputStream</code>s will not copy data unnecessarily.
  26.113 -     *
  26.114 -     * @param      b     the data.
  26.115 -     * @param      off   the start offset in the data.
  26.116 -     * @param      len   the number of bytes to write.
  26.117 -     * @exception  IOException  if an I/O error occurs.
  26.118 -     */
  26.119 -    public synchronized void write(byte b[], int off, int len) throws IOException {
  26.120 -        if (len >= buf.length) {
  26.121 -            /* If the request length exceeds the size of the output buffer,
  26.122 -               flush the output buffer and then write the data directly.
  26.123 -               In this way buffered streams will cascade harmlessly. */
  26.124 -            flushBuffer();
  26.125 -            out.write(b, off, len);
  26.126 -            return;
  26.127 -        }
  26.128 -        if (len > buf.length - count) {
  26.129 -            flushBuffer();
  26.130 -        }
  26.131 -        System.arraycopy(b, off, buf, count, len);
  26.132 -        count += len;
  26.133 -    }
  26.134 -
  26.135 -    /**
  26.136 -     * Flushes this buffered output stream. This forces any buffered
  26.137 -     * output bytes to be written out to the 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 synchronized void flush() throws IOException {
  26.143 -        flushBuffer();
  26.144 -        out.flush();
  26.145 -    }
  26.146 -}
    27.1 --- a/emul/compact/src/main/java/java/io/BufferedReader.java	Fri Mar 22 16:59:47 2013 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,523 +0,0 @@
    27.4 -/*
    27.5 - * Copyright (c) 1996, 2011, 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 -
   27.32 -
   27.33 -/**
   27.34 - * Reads text from a character-input stream, buffering characters so as to
   27.35 - * provide for the efficient reading of characters, arrays, and lines.
   27.36 - *
   27.37 - * <p> The buffer size may be specified, or the default size may be used.  The
   27.38 - * default is large enough for most purposes.
   27.39 - *
   27.40 - * <p> In general, each read request made of a Reader causes a corresponding
   27.41 - * read request to be made of the underlying character or byte stream.  It is
   27.42 - * therefore advisable to wrap a BufferedReader around any Reader whose read()
   27.43 - * operations may be costly, such as FileReaders and InputStreamReaders.  For
   27.44 - * example,
   27.45 - *
   27.46 - * <pre>
   27.47 - * BufferedReader in
   27.48 - *   = new BufferedReader(new FileReader("foo.in"));
   27.49 - * </pre>
   27.50 - *
   27.51 - * will buffer the input from the specified file.  Without buffering, each
   27.52 - * invocation of read() or readLine() could cause bytes to be read from the
   27.53 - * file, converted into characters, and then returned, which can be very
   27.54 - * inefficient.
   27.55 - *
   27.56 - * <p> Programs that use DataInputStreams for textual input can be localized by
   27.57 - * replacing each DataInputStream with an appropriate BufferedReader.
   27.58 - *
   27.59 - * @see FileReader
   27.60 - * @see InputStreamReader
   27.61 - * @see java.nio.file.Files#newBufferedReader
   27.62 - *
   27.63 - * @author      Mark Reinhold
   27.64 - * @since       JDK1.1
   27.65 - */
   27.66 -
   27.67 -public class BufferedReader extends Reader {
   27.68 -
   27.69 -    private Reader in;
   27.70 -
   27.71 -    private char cb[];
   27.72 -    private int nChars, nextChar;
   27.73 -
   27.74 -    private static final int INVALIDATED = -2;
   27.75 -    private static final int UNMARKED = -1;
   27.76 -    private int markedChar = UNMARKED;
   27.77 -    private int readAheadLimit = 0; /* Valid only when markedChar > 0 */
   27.78 -
   27.79 -    /** If the next character is a line feed, skip it */
   27.80 -    private boolean skipLF = false;
   27.81 -
   27.82 -    /** The skipLF flag when the mark was set */
   27.83 -    private boolean markedSkipLF = false;
   27.84 -
   27.85 -    private static int defaultCharBufferSize = 8192;
   27.86 -    private static int defaultExpectedLineLength = 80;
   27.87 -
   27.88 -    /**
   27.89 -     * Creates a buffering character-input stream that uses an input buffer of
   27.90 -     * the specified size.
   27.91 -     *
   27.92 -     * @param  in   A Reader
   27.93 -     * @param  sz   Input-buffer size
   27.94 -     *
   27.95 -     * @exception  IllegalArgumentException  If sz is <= 0
   27.96 -     */
   27.97 -    public BufferedReader(Reader in, int sz) {
   27.98 -        super(in);
   27.99 -        if (sz <= 0)
  27.100 -            throw new IllegalArgumentException("Buffer size <= 0");
  27.101 -        this.in = in;
  27.102 -        cb = new char[sz];
  27.103 -        nextChar = nChars = 0;
  27.104 -    }
  27.105 -
  27.106 -    /**
  27.107 -     * Creates a buffering character-input stream that uses a default-sized
  27.108 -     * input buffer.
  27.109 -     *
  27.110 -     * @param  in   A Reader
  27.111 -     */
  27.112 -    public BufferedReader(Reader in) {
  27.113 -        this(in, defaultCharBufferSize);
  27.114 -    }
  27.115 -
  27.116 -    /** Checks to make sure that the stream has not been closed */
  27.117 -    private void ensureOpen() throws IOException {
  27.118 -        if (in == null)
  27.119 -            throw new IOException("Stream closed");
  27.120 -    }
  27.121 -
  27.122 -    /**
  27.123 -     * Fills the input buffer, taking the mark into account if it is valid.
  27.124 -     */
  27.125 -    private void fill() throws IOException {
  27.126 -        int dst;
  27.127 -        if (markedChar <= UNMARKED) {
  27.128 -            /* No mark */
  27.129 -            dst = 0;
  27.130 -        } else {
  27.131 -            /* Marked */
  27.132 -            int delta = nextChar - markedChar;
  27.133 -            if (delta >= readAheadLimit) {
  27.134 -                /* Gone past read-ahead limit: Invalidate mark */
  27.135 -                markedChar = INVALIDATED;
  27.136 -                readAheadLimit = 0;
  27.137 -                dst = 0;
  27.138 -            } else {
  27.139 -                if (readAheadLimit <= cb.length) {
  27.140 -                    /* Shuffle in the current buffer */
  27.141 -                    System.arraycopy(cb, markedChar, cb, 0, delta);
  27.142 -                    markedChar = 0;
  27.143 -                    dst = delta;
  27.144 -                } else {
  27.145 -                    /* Reallocate buffer to accommodate read-ahead limit */
  27.146 -                    char ncb[] = new char[readAheadLimit];
  27.147 -                    System.arraycopy(cb, markedChar, ncb, 0, delta);
  27.148 -                    cb = ncb;
  27.149 -                    markedChar = 0;
  27.150 -                    dst = delta;
  27.151 -                }
  27.152 -                nextChar = nChars = delta;
  27.153 -            }
  27.154 -        }
  27.155 -
  27.156 -        int n;
  27.157 -        do {
  27.158 -            n = in.read(cb, dst, cb.length - dst);
  27.159 -        } while (n == 0);
  27.160 -        if (n > 0) {
  27.161 -            nChars = dst + n;
  27.162 -            nextChar = dst;
  27.163 -        }
  27.164 -    }
  27.165 -
  27.166 -    /**
  27.167 -     * Reads a single character.
  27.168 -     *
  27.169 -     * @return The character read, as an integer in the range
  27.170 -     *         0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
  27.171 -     *         end of the stream has been reached
  27.172 -     * @exception  IOException  If an I/O error occurs
  27.173 -     */
  27.174 -    public int read() throws IOException {
  27.175 -        synchronized (lock) {
  27.176 -            ensureOpen();
  27.177 -            for (;;) {
  27.178 -                if (nextChar >= nChars) {
  27.179 -                    fill();
  27.180 -                    if (nextChar >= nChars)
  27.181 -                        return -1;
  27.182 -                }
  27.183 -                if (skipLF) {
  27.184 -                    skipLF = false;
  27.185 -                    if (cb[nextChar] == '\n') {
  27.186 -                        nextChar++;
  27.187 -                        continue;
  27.188 -                    }
  27.189 -                }
  27.190 -                return cb[nextChar++];
  27.191 -            }
  27.192 -        }
  27.193 -    }
  27.194 -
  27.195 -    /**
  27.196 -     * Reads characters into a portion of an array, reading from the underlying
  27.197 -     * stream if necessary.
  27.198 -     */
  27.199 -    private int read1(char[] cbuf, int off, int len) throws IOException {
  27.200 -        if (nextChar >= nChars) {
  27.201 -            /* If the requested length is at least as large as the buffer, and
  27.202 -               if there is no mark/reset activity, and if line feeds are not
  27.203 -               being skipped, do not bother to copy the characters into the
  27.204 -               local buffer.  In this way buffered streams will cascade
  27.205 -               harmlessly. */
  27.206 -            if (len >= cb.length && markedChar <= UNMARKED && !skipLF) {
  27.207 -                return in.read(cbuf, off, len);
  27.208 -            }
  27.209 -            fill();
  27.210 -        }
  27.211 -        if (nextChar >= nChars) return -1;
  27.212 -        if (skipLF) {
  27.213 -            skipLF = false;
  27.214 -            if (cb[nextChar] == '\n') {
  27.215 -                nextChar++;
  27.216 -                if (nextChar >= nChars)
  27.217 -                    fill();
  27.218 -                if (nextChar >= nChars)
  27.219 -                    return -1;
  27.220 -            }
  27.221 -        }
  27.222 -        int n = Math.min(len, nChars - nextChar);
  27.223 -        System.arraycopy(cb, nextChar, cbuf, off, n);
  27.224 -        nextChar += n;
  27.225 -        return n;
  27.226 -    }
  27.227 -
  27.228 -    /**
  27.229 -     * Reads characters into a portion of an array.
  27.230 -     *
  27.231 -     * <p> This method implements the general contract of the corresponding
  27.232 -     * <code>{@link Reader#read(char[], int, int) read}</code> method of the
  27.233 -     * <code>{@link Reader}</code> class.  As an additional convenience, it
  27.234 -     * attempts to read as many characters as possible by repeatedly invoking
  27.235 -     * the <code>read</code> method of the underlying stream.  This iterated
  27.236 -     * <code>read</code> continues until one of the following conditions becomes
  27.237 -     * true: <ul>
  27.238 -     *
  27.239 -     *   <li> The specified number of characters have been read,
  27.240 -     *
  27.241 -     *   <li> The <code>read</code> method of the underlying stream returns
  27.242 -     *   <code>-1</code>, indicating end-of-file, or
  27.243 -     *
  27.244 -     *   <li> The <code>ready</code> method of the underlying stream
  27.245 -     *   returns <code>false</code>, indicating that further input requests
  27.246 -     *   would block.
  27.247 -     *
  27.248 -     * </ul> If the first <code>read</code> on the underlying stream returns
  27.249 -     * <code>-1</code> to indicate end-of-file then this method returns
  27.250 -     * <code>-1</code>.  Otherwise this method returns the number of characters
  27.251 -     * actually read.
  27.252 -     *
  27.253 -     * <p> Subclasses of this class are encouraged, but not required, to
  27.254 -     * attempt to read as many characters as possible in the same fashion.
  27.255 -     *
  27.256 -     * <p> Ordinarily this method takes characters from this stream's character
  27.257 -     * buffer, filling it from the underlying stream as necessary.  If,
  27.258 -     * however, the buffer is empty, the mark is not valid, and the requested
  27.259 -     * length is at least as large as the buffer, then this method will read
  27.260 -     * characters directly from the underlying stream into the given array.
  27.261 -     * Thus redundant <code>BufferedReader</code>s will not copy data
  27.262 -     * unnecessarily.
  27.263 -     *
  27.264 -     * @param      cbuf  Destination buffer
  27.265 -     * @param      off   Offset at which to start storing characters
  27.266 -     * @param      len   Maximum number of characters to read
  27.267 -     *
  27.268 -     * @return     The number of characters read, or -1 if the end of the
  27.269 -     *             stream has been reached
  27.270 -     *
  27.271 -     * @exception  IOException  If an I/O error occurs
  27.272 -     */
  27.273 -    public int read(char cbuf[], int off, int len) throws IOException {
  27.274 -        synchronized (lock) {
  27.275 -            ensureOpen();
  27.276 -            if ((off < 0) || (off > cbuf.length) || (len < 0) ||
  27.277 -                ((off + len) > cbuf.length) || ((off + len) < 0)) {
  27.278 -                throw new IndexOutOfBoundsException();
  27.279 -            } else if (len == 0) {
  27.280 -                return 0;
  27.281 -            }
  27.282 -
  27.283 -            int n = read1(cbuf, off, len);
  27.284 -            if (n <= 0) return n;
  27.285 -            while ((n < len) && in.ready()) {
  27.286 -                int n1 = read1(cbuf, off + n, len - n);
  27.287 -                if (n1 <= 0) break;
  27.288 -                n += n1;
  27.289 -            }
  27.290 -            return n;
  27.291 -        }
  27.292 -    }
  27.293 -
  27.294 -    /**
  27.295 -     * Reads a line of text.  A line is considered to be terminated by any one
  27.296 -     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
  27.297 -     * followed immediately by a linefeed.
  27.298 -     *
  27.299 -     * @param      ignoreLF  If true, the next '\n' will be skipped
  27.300 -     *
  27.301 -     * @return     A String containing the contents of the line, not including
  27.302 -     *             any line-termination characters, or null if the end of the
  27.303 -     *             stream has been reached
  27.304 -     *
  27.305 -     * @see        java.io.LineNumberReader#readLine()
  27.306 -     *
  27.307 -     * @exception  IOException  If an I/O error occurs
  27.308 -     */
  27.309 -    String readLine(boolean ignoreLF) throws IOException {
  27.310 -        StringBuffer s = null;
  27.311 -        int startChar;
  27.312 -
  27.313 -        synchronized (lock) {
  27.314 -            ensureOpen();
  27.315 -            boolean omitLF = ignoreLF || skipLF;
  27.316 -
  27.317 -        bufferLoop:
  27.318 -            for (;;) {
  27.319 -
  27.320 -                if (nextChar >= nChars)
  27.321 -                    fill();
  27.322 -                if (nextChar >= nChars) { /* EOF */
  27.323 -                    if (s != null && s.length() > 0)
  27.324 -                        return s.toString();
  27.325 -                    else
  27.326 -                        return null;
  27.327 -                }
  27.328 -                boolean eol = false;
  27.329 -                char c = 0;
  27.330 -                int i;
  27.331 -
  27.332 -                /* Skip a leftover '\n', if necessary */
  27.333 -                if (omitLF && (cb[nextChar] == '\n'))
  27.334 -                    nextChar++;
  27.335 -                skipLF = false;
  27.336 -                omitLF = false;
  27.337 -
  27.338 -            charLoop:
  27.339 -                for (i = nextChar; i < nChars; i++) {
  27.340 -                    c = cb[i];
  27.341 -                    if ((c == '\n') || (c == '\r')) {
  27.342 -                        eol = true;
  27.343 -                        break charLoop;
  27.344 -                    }
  27.345 -                }
  27.346 -
  27.347 -                startChar = nextChar;
  27.348 -                nextChar = i;
  27.349 -
  27.350 -                if (eol) {
  27.351 -                    String str;
  27.352 -                    if (s == null) {
  27.353 -                        str = new String(cb, startChar, i - startChar);
  27.354 -                    } else {
  27.355 -                        s.append(cb, startChar, i - startChar);
  27.356 -                        str = s.toString();
  27.357 -                    }
  27.358 -                    nextChar++;
  27.359 -                    if (c == '\r') {
  27.360 -                        skipLF = true;
  27.361 -                    }
  27.362 -                    return str;
  27.363 -                }
  27.364 -
  27.365 -                if (s == null)
  27.366 -                    s = new StringBuffer(defaultExpectedLineLength);
  27.367 -                s.append(cb, startChar, i - startChar);
  27.368 -            }
  27.369 -        }
  27.370 -    }
  27.371 -
  27.372 -    /**
  27.373 -     * Reads a line of text.  A line is considered to be terminated by any one
  27.374 -     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
  27.375 -     * followed immediately by a linefeed.
  27.376 -     *
  27.377 -     * @return     A String containing the contents of the line, not including
  27.378 -     *             any line-termination characters, or null if the end of the
  27.379 -     *             stream has been reached
  27.380 -     *
  27.381 -     * @exception  IOException  If an I/O error occurs
  27.382 -     *
  27.383 -     * @see java.nio.file.Files#readAllLines
  27.384 -     */
  27.385 -    public String readLine() throws IOException {
  27.386 -        return readLine(false);
  27.387 -    }
  27.388 -
  27.389 -    /**
  27.390 -     * Skips characters.
  27.391 -     *
  27.392 -     * @param  n  The number of characters to skip
  27.393 -     *
  27.394 -     * @return    The number of characters actually skipped
  27.395 -     *
  27.396 -     * @exception  IllegalArgumentException  If <code>n</code> is negative.
  27.397 -     * @exception  IOException  If an I/O error occurs
  27.398 -     */
  27.399 -    public long skip(long n) throws IOException {
  27.400 -        if (n < 0L) {
  27.401 -            throw new IllegalArgumentException("skip value is negative");
  27.402 -        }
  27.403 -        synchronized (lock) {
  27.404 -            ensureOpen();
  27.405 -            long r = n;
  27.406 -            while (r > 0) {
  27.407 -                if (nextChar >= nChars)
  27.408 -                    fill();
  27.409 -                if (nextChar >= nChars) /* EOF */
  27.410 -                    break;
  27.411 -                if (skipLF) {
  27.412 -                    skipLF = false;
  27.413 -                    if (cb[nextChar] == '\n') {
  27.414 -                        nextChar++;
  27.415 -                    }
  27.416 -                }
  27.417 -                long d = nChars - nextChar;
  27.418 -                if (r <= d) {
  27.419 -                    nextChar += r;
  27.420 -                    r = 0;
  27.421 -                    break;
  27.422 -                }
  27.423 -                else {
  27.424 -                    r -= d;
  27.425 -                    nextChar = nChars;
  27.426 -                }
  27.427 -            }
  27.428 -            return n - r;
  27.429 -        }
  27.430 -    }
  27.431 -
  27.432 -    /**
  27.433 -     * Tells whether this stream is ready to be read.  A buffered character
  27.434 -     * stream is ready if the buffer is not empty, or if the underlying
  27.435 -     * character stream is ready.
  27.436 -     *
  27.437 -     * @exception  IOException  If an I/O error occurs
  27.438 -     */
  27.439 -    public boolean ready() throws IOException {
  27.440 -        synchronized (lock) {
  27.441 -            ensureOpen();
  27.442 -
  27.443 -            /*
  27.444 -             * If newline needs to be skipped and the next char to be read
  27.445 -             * is a newline character, then just skip it right away.
  27.446 -             */
  27.447 -            if (skipLF) {
  27.448 -                /* Note that in.ready() will return true if and only if the next
  27.449 -                 * read on the stream will not block.
  27.450 -                 */
  27.451 -                if (nextChar >= nChars && in.ready()) {
  27.452 -                    fill();
  27.453 -                }
  27.454 -                if (nextChar < nChars) {
  27.455 -                    if (cb[nextChar] == '\n')
  27.456 -                        nextChar++;
  27.457 -                    skipLF = false;
  27.458 -                }
  27.459 -            }
  27.460 -            return (nextChar < nChars) || in.ready();
  27.461 -        }
  27.462 -    }
  27.463 -
  27.464 -    /**
  27.465 -     * Tells whether this stream supports the mark() operation, which it does.
  27.466 -     */
  27.467 -    public boolean markSupported() {
  27.468 -        return true;
  27.469 -    }
  27.470 -
  27.471 -    /**
  27.472 -     * Marks the present position in the stream.  Subsequent calls to reset()
  27.473 -     * will attempt to reposition the stream to this point.
  27.474 -     *
  27.475 -     * @param readAheadLimit   Limit on the number of characters that may be
  27.476 -     *                         read while still preserving the mark. An attempt
  27.477 -     *                         to reset the stream after reading characters
  27.478 -     *                         up to this limit or beyond may fail.
  27.479 -     *                         A limit value larger than the size of the input
  27.480 -     *                         buffer will cause a new buffer to be allocated
  27.481 -     *                         whose size is no smaller than limit.
  27.482 -     *                         Therefore large values should be used with care.
  27.483 -     *
  27.484 -     * @exception  IllegalArgumentException  If readAheadLimit is < 0
  27.485 -     * @exception  IOException  If an I/O error occurs
  27.486 -     */
  27.487 -    public void mark(int readAheadLimit) throws IOException {
  27.488 -        if (readAheadLimit < 0) {
  27.489 -            throw new IllegalArgumentException("Read-ahead limit < 0");
  27.490 -        }
  27.491 -        synchronized (lock) {
  27.492 -            ensureOpen();
  27.493 -            this.readAheadLimit = readAheadLimit;
  27.494 -            markedChar = nextChar;
  27.495 -            markedSkipLF = skipLF;
  27.496 -        }
  27.497 -    }
  27.498 -
  27.499 -    /**
  27.500 -     * Resets the stream to the most recent mark.
  27.501 -     *
  27.502 -     * @exception  IOException  If the stream has never been marked,
  27.503 -     *                          or if the mark has been invalidated
  27.504 -     */
  27.505 -    public void reset() throws IOException {
  27.506 -        synchronized (lock) {
  27.507 -            ensureOpen();
  27.508 -            if (markedChar < 0)
  27.509 -                throw new IOException((markedChar == INVALIDATED)
  27.510 -                                      ? "Mark invalid"
  27.511 -                                      : "Stream not marked");
  27.512 -            nextChar = markedChar;
  27.513 -            skipLF = markedSkipLF;
  27.514 -        }
  27.515 -    }
  27.516 -
  27.517 -    public void close() throws IOException {
  27.518 -        synchronized (lock) {
  27.519 -            if (in == null)
  27.520 -                return;
  27.521 -            in.close();
  27.522 -            in = null;
  27.523 -            cb = null;
  27.524 -        }
  27.525 -    }
  27.526 -}
    28.1 --- a/emul/compact/src/main/java/java/io/ByteArrayOutputStream.java	Fri Mar 22 16:59:47 2013 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,272 +0,0 @@
    28.4 -/*
    28.5 - * Copyright (c) 1994, 2010, 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 -import java.util.Arrays;
   28.32 -
   28.33 -/**
   28.34 - * This class implements an output stream in which the data is
   28.35 - * written into a byte array. The buffer automatically grows as data
   28.36 - * is written to it.
   28.37 - * The data can be retrieved using <code>toByteArray()</code> and
   28.38 - * <code>toString()</code>.
   28.39 - * <p>
   28.40 - * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
   28.41 - * this class can be called after the stream has been closed without
   28.42 - * generating an <tt>IOException</tt>.
   28.43 - *
   28.44 - * @author  Arthur van Hoff
   28.45 - * @since   JDK1.0
   28.46 - */
   28.47 -
   28.48 -public class ByteArrayOutputStream extends OutputStream {
   28.49 -
   28.50 -    /**
   28.51 -     * The buffer where data is stored.
   28.52 -     */
   28.53 -    protected byte buf[];
   28.54 -
   28.55 -    /**
   28.56 -     * The number of valid bytes in the buffer.
   28.57 -     */
   28.58 -    protected int count;
   28.59 -
   28.60 -    /**
   28.61 -     * Creates a new byte array output stream. The buffer capacity is
   28.62 -     * initially 32 bytes, though its size increases if necessary.
   28.63 -     */
   28.64 -    public ByteArrayOutputStream() {
   28.65 -        this(32);
   28.66 -    }
   28.67 -
   28.68 -    /**
   28.69 -     * Creates a new byte array output stream, with a buffer capacity of
   28.70 -     * the specified size, in bytes.
   28.71 -     *
   28.72 -     * @param   size   the initial size.
   28.73 -     * @exception  IllegalArgumentException if size is negative.
   28.74 -     */
   28.75 -    public ByteArrayOutputStream(int size) {
   28.76 -        if (size < 0) {
   28.77 -            throw new IllegalArgumentException("Negative initial size: "
   28.78 -                                               + size);
   28.79 -        }
   28.80 -        buf = new byte[size];
   28.81 -    }
   28.82 -
   28.83 -    /**
   28.84 -     * Increases the capacity if necessary to ensure that it can hold
   28.85 -     * at least the number of elements specified by the minimum
   28.86 -     * capacity argument.
   28.87 -     *
   28.88 -     * @param minCapacity the desired minimum capacity
   28.89 -     * @throws OutOfMemoryError if {@code minCapacity < 0}.  This is
   28.90 -     * interpreted as a request for the unsatisfiably large capacity
   28.91 -     * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.
   28.92 -     */
   28.93 -    private void ensureCapacity(int minCapacity) {
   28.94 -        // overflow-conscious code
   28.95 -        if (minCapacity - buf.length > 0)
   28.96 -            grow(minCapacity);
   28.97 -    }
   28.98 -
   28.99 -    /**
  28.100 -     * Increases the capacity to ensure that it can hold at least the
  28.101 -     * number of elements specified by the minimum capacity argument.
  28.102 -     *
  28.103 -     * @param minCapacity the desired minimum capacity
  28.104 -     */
  28.105 -    private void grow(int minCapacity) {
  28.106 -        // overflow-conscious code
  28.107 -        int oldCapacity = buf.length;
  28.108 -        int newCapacity = oldCapacity << 1;
  28.109 -        if (newCapacity - minCapacity < 0)
  28.110 -            newCapacity = minCapacity;
  28.111 -        if (newCapacity < 0) {
  28.112 -            if (minCapacity < 0) // overflow
  28.113 -                throw new OutOfMemoryError();
  28.114 -            newCapacity = Integer.MAX_VALUE;
  28.115 -        }
  28.116 -        buf = Arrays.copyOf(buf, newCapacity);
  28.117 -    }
  28.118 -
  28.119 -    /**
  28.120 -     * Writes the specified byte to this byte array output stream.
  28.121 -     *
  28.122 -     * @param   b   the byte to be written.
  28.123 -     */
  28.124 -    public synchronized void write(int b) {
  28.125 -        ensureCapacity(count + 1);
  28.126 -        buf[count] = (byte) b;
  28.127 -        count += 1;
  28.128 -    }
  28.129 -
  28.130 -    /**
  28.131 -     * Writes <code>len</code> bytes from the specified byte array
  28.132 -     * starting at offset <code>off</code> to this byte array output stream.
  28.133 -     *
  28.134 -     * @param   b     the data.
  28.135 -     * @param   off   the start offset in the data.
  28.136 -     * @param   len   the number of bytes to write.
  28.137 -     */
  28.138 -    public synchronized void write(byte b[], int off, int len) {
  28.139 -        if ((off < 0) || (off > b.length) || (len < 0) ||
  28.140 -            ((off + len) - b.length > 0)) {
  28.141 -            throw new IndexOutOfBoundsException();
  28.142 -        }
  28.143 -        ensureCapacity(count + len);
  28.144 -        System.arraycopy(b, off, buf, count, len);
  28.145 -        count += len;
  28.146 -    }
  28.147 -
  28.148 -    /**
  28.149 -     * Writes the complete contents of this byte array output stream to
  28.150 -     * the specified output stream argument, as if by calling the output
  28.151 -     * stream's write method using <code>out.write(buf, 0, count)</code>.
  28.152 -     *
  28.153 -     * @param      out   the output stream to which to write the data.
  28.154 -     * @exception  IOException  if an I/O error occurs.
  28.155 -     */
  28.156 -    public synchronized void writeTo(OutputStream out) throws IOException {
  28.157 -        out.write(buf, 0, count);
  28.158 -    }
  28.159 -
  28.160 -    /**
  28.161 -     * Resets the <code>count</code> field of this byte array output
  28.162 -     * stream to zero, so that all currently accumulated output in the
  28.163 -     * output stream is discarded. The output stream can be used again,
  28.164 -     * reusing the already allocated buffer space.
  28.165 -     *
  28.166 -     * @see     java.io.ByteArrayInputStream#count
  28.167 -     */
  28.168 -    public synchronized void reset() {
  28.169 -        count = 0;
  28.170 -    }
  28.171 -
  28.172 -    /**
  28.173 -     * Creates a newly allocated byte array. Its size is the current
  28.174 -     * size of this output stream and the valid contents of the buffer
  28.175 -     * have been copied into it.
  28.176 -     *
  28.177 -     * @return  the current contents of this output stream, as a byte array.
  28.178 -     * @see     java.io.ByteArrayOutputStream#size()
  28.179 -     */
  28.180 -    public synchronized byte toByteArray()[] {
  28.181 -        return Arrays.copyOf(buf, count);
  28.182 -    }
  28.183 -
  28.184 -    /**
  28.185 -     * Returns the current size of the buffer.
  28.186 -     *
  28.187 -     * @return  the value of the <code>count</code> field, which is the number
  28.188 -     *          of valid bytes in this output stream.
  28.189 -     * @see     java.io.ByteArrayOutputStream#count
  28.190 -     */
  28.191 -    public synchronized int size() {
  28.192 -        return count;
  28.193 -    }
  28.194 -
  28.195 -    /**
  28.196 -     * Converts the buffer's contents into a string decoding bytes using the
  28.197 -     * platform's default character set. The length of the new <tt>String</tt>
  28.198 -     * is a function of the character set, and hence may not be equal to the
  28.199 -     * size of the buffer.
  28.200 -     *
  28.201 -     * <p> This method always replaces malformed-input and unmappable-character
  28.202 -     * sequences with the default replacement string for the platform's
  28.203 -     * default character set. The {@linkplain java.nio.charset.CharsetDecoder}
  28.204 -     * class should be used when more control over the decoding process is
  28.205 -     * required.
  28.206 -     *
  28.207 -     * @return String decoded from the buffer's contents.
  28.208 -     * @since  JDK1.1
  28.209 -     */
  28.210 -    public synchronized String toString() {
  28.211 -        return new String(buf, 0, count);
  28.212 -    }
  28.213 -
  28.214 -    /**
  28.215 -     * Converts the buffer's contents into a string by decoding the bytes using
  28.216 -     * the specified {@link java.nio.charset.Charset charsetName}. The length of
  28.217 -     * the new <tt>String</tt> is a function of the charset, and hence may not be
  28.218 -     * equal to the length of the byte array.
  28.219 -     *
  28.220 -     * <p> This method always replaces malformed-input and unmappable-character
  28.221 -     * sequences with this charset's default replacement string. The {@link
  28.222 -     * java.nio.charset.CharsetDecoder} class should be used when more control
  28.223 -     * over the decoding process is required.
  28.224 -     *
  28.225 -     * @param  charsetName  the name of a supported
  28.226 -     *              {@linkplain java.nio.charset.Charset </code>charset<code>}
  28.227 -     * @return String decoded from the buffer's contents.
  28.228 -     * @exception  UnsupportedEncodingException
  28.229 -     *             If the named charset is not supported
  28.230 -     * @since   JDK1.1
  28.231 -     */
  28.232 -    public synchronized String toString(String charsetName)
  28.233 -        throws UnsupportedEncodingException
  28.234 -    {
  28.235 -        return new String(buf, 0, count, charsetName);
  28.236 -    }
  28.237 -
  28.238 -    /**
  28.239 -     * Creates a newly allocated string. Its size is the current size of
  28.240 -     * the output stream and the valid contents of the buffer have been
  28.241 -     * copied into it. Each character <i>c</i> in the resulting string is
  28.242 -     * constructed from the corresponding element <i>b</i> in the byte
  28.243 -     * array such that:
  28.244 -     * <blockquote><pre>
  28.245 -     *     c == (char)(((hibyte &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
  28.246 -     * </pre></blockquote>
  28.247 -     *
  28.248 -     * @deprecated This method does not properly convert bytes into characters.
  28.249 -     * As of JDK&nbsp;1.1, the preferred way to do this is via the
  28.250 -     * <code>toString(String enc)</code> method, which takes an encoding-name
  28.251 -     * argument, or the <code>toString()</code> method, which uses the
  28.252 -     * platform's default character encoding.
  28.253 -     *
  28.254 -     * @param      hibyte    the high byte of each resulting Unicode character.
  28.255 -     * @return     the current contents of the output stream, as a string.
  28.256 -     * @see        java.io.ByteArrayOutputStream#size()
  28.257 -     * @see        java.io.ByteArrayOutputStream#toString(String)
  28.258 -     * @see        java.io.ByteArrayOutputStream#toString()
  28.259 -     */
  28.260 -    @Deprecated
  28.261 -    public synchronized String toString(int hibyte) {
  28.262 -        return new String(buf, hibyte, 0, count);
  28.263 -    }
  28.264 -
  28.265 -    /**
  28.266 -     * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
  28.267 -     * this class can be called after the stream has been closed without
  28.268 -     * generating an <tt>IOException</tt>.
  28.269 -     * <p>
  28.270 -     *
  28.271 -     */
  28.272 -    public void close() throws IOException {
  28.273 -    }
  28.274 -
  28.275 -}
    29.1 --- a/emul/compact/src/main/java/java/io/DataOutput.java	Fri Mar 22 16:59:47 2013 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,354 +0,0 @@
    29.4 -/*
    29.5 - * Copyright (c) 1995, 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 - * The <code>DataOutput</code> interface provides
   29.33 - * for converting data from any of the Java
   29.34 - * primitive types to a series of bytes and
   29.35 - * writing these bytes to a binary stream.
   29.36 - * There is  also a facility for converting
   29.37 - * a <code>String</code> into
   29.38 - * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
   29.39 - * format and writing the resulting series
   29.40 - * of bytes.
   29.41 - * <p>
   29.42 - * For all the methods in this interface that
   29.43 - * write bytes, it is generally true that if
   29.44 - * a byte cannot be written for any reason,
   29.45 - * an <code>IOException</code> is thrown.
   29.46 - *
   29.47 - * @author  Frank Yellin
   29.48 - * @see     java.io.DataInput
   29.49 - * @see     java.io.DataOutputStream
   29.50 - * @since   JDK1.0
   29.51 - */
   29.52 -public
   29.53 -interface DataOutput {
   29.54 -    /**
   29.55 -     * Writes to the output stream the eight
   29.56 -     * low-order bits of the argument <code>b</code>.
   29.57 -     * The 24 high-order  bits of <code>b</code>
   29.58 -     * are ignored.
   29.59 -     *
   29.60 -     * @param      b   the byte to be written.
   29.61 -     * @throws     IOException  if an I/O error occurs.
   29.62 -     */
   29.63 -    void write(int b) throws IOException;
   29.64 -
   29.65 -    /**
   29.66 -     * Writes to the output stream all the bytes in array <code>b</code>.
   29.67 -     * If <code>b</code> is <code>null</code>,
   29.68 -     * a <code>NullPointerException</code> is thrown.
   29.69 -     * If <code>b.length</code> is zero, then
   29.70 -     * no bytes are written. Otherwise, the byte
   29.71 -     * <code>b[0]</code> is written first, then
   29.72 -     * <code>b[1]</code>, and so on; the last byte
   29.73 -     * written is <code>b[b.length-1]</code>.
   29.74 -     *
   29.75 -     * @param      b   the data.
   29.76 -     * @throws     IOException  if an I/O error occurs.
   29.77 -     */
   29.78 -    void write(byte b[]) throws IOException;
   29.79 -
   29.80 -    /**
   29.81 -     * Writes <code>len</code> bytes from array
   29.82 -     * <code>b</code>, in order,  to
   29.83 -     * the output stream.  If <code>b</code>
   29.84 -     * is <code>null</code>, a <code>NullPointerException</code>
   29.85 -     * is thrown.  If <code>off</code> is negative,
   29.86 -     * or <code>len</code> is negative, or <code>off+len</code>
   29.87 -     * is greater than the length of the array
   29.88 -     * <code>b</code>, then an <code>IndexOutOfBoundsException</code>
   29.89 -     * is thrown.  If <code>len</code> is zero,
   29.90 -     * then no bytes are written. Otherwise, the
   29.91 -     * byte <code>b[off]</code> is written first,
   29.92 -     * then <code>b[off+1]</code>, and so on; the
   29.93 -     * last byte written is <code>b[off+len-1]</code>.
   29.94 -     *
   29.95 -     * @param      b     the data.
   29.96 -     * @param      off   the start offset in the data.
   29.97 -     * @param      len   the number of bytes to write.
   29.98 -     * @throws     IOException  if an I/O error occurs.
   29.99 -     */
  29.100 -    void write(byte b[], int off, int len) throws IOException;
  29.101 -
  29.102 -    /**
  29.103 -     * Writes a <code>boolean</code> value to this output stream.
  29.104 -     * If the argument <code>v</code>
  29.105 -     * is <code>true</code>, the value <code>(byte)1</code>
  29.106 -     * is written; if <code>v</code> is <code>false</code>,
  29.107 -     * the  value <code>(byte)0</code> is written.
  29.108 -     * The byte written by this method may
  29.109 -     * be read by the <code>readBoolean</code>
  29.110 -     * method of interface <code>DataInput</code>,
  29.111 -     * which will then return a <code>boolean</code>
  29.112 -     * equal to <code>v</code>.
  29.113 -     *
  29.114 -     * @param      v   the boolean to be written.
  29.115 -     * @throws     IOException  if an I/O error occurs.
  29.116 -     */
  29.117 -    void writeBoolean(boolean v) throws IOException;
  29.118 -
  29.119 -    /**
  29.120 -     * Writes to the output stream the eight low-
  29.121 -     * order bits of the argument <code>v</code>.
  29.122 -     * The 24 high-order bits of <code>v</code>
  29.123 -     * are ignored. (This means  that <code>writeByte</code>
  29.124 -     * does exactly the same thing as <code>write</code>
  29.125 -     * for an integer argument.) The byte written
  29.126 -     * by this method may be read by the <code>readByte</code>
  29.127 -     * method of interface <code>DataInput</code>,
  29.128 -     * which will then return a <code>byte</code>
  29.129 -     * equal to <code>(byte)v</code>.
  29.130 -     *
  29.131 -     * @param      v   the byte value to be written.
  29.132 -     * @throws     IOException  if an I/O error occurs.
  29.133 -     */
  29.134 -    void writeByte(int v) throws IOException;
  29.135 -
  29.136 -    /**
  29.137 -     * Writes two bytes to the output
  29.138 -     * stream to represent the value of the argument.
  29.139 -     * The byte values to be written, in the  order
  29.140 -     * shown, are: <p>
  29.141 -     * <pre><code>
  29.142 -     * (byte)(0xff &amp; (v &gt;&gt; 8))
  29.143 -     * (byte)(0xff &amp; v)
  29.144 -     * </code> </pre> <p>
  29.145 -     * The bytes written by this method may be
  29.146 -     * read by the <code>readShort</code> method
  29.147 -     * of interface <code>DataInput</code> , which
  29.148 -     * will then return a <code>short</code> equal
  29.149 -     * to <code>(short)v</code>.
  29.150 -     *
  29.151 -     * @param      v   the <code>short</code> value to be written.
  29.152 -     * @throws     IOException  if an I/O error occurs.
  29.153 -     */
  29.154 -    void writeShort(int v) throws IOException;
  29.155 -
  29.156 -    /**
  29.157 -     * Writes a <code>char</code> value, which
  29.158 -     * is comprised of two bytes, to the
  29.159 -     * output stream.
  29.160 -     * The byte values to be written, in the  order
  29.161 -     * shown, are:
  29.162 -     * <p><pre><code>
  29.163 -     * (byte)(0xff &amp; (v &gt;&gt; 8))
  29.164 -     * (byte)(0xff &amp; v)
  29.165 -     * </code></pre><p>
  29.166 -     * The bytes written by this method may be
  29.167 -     * read by the <code>readChar</code> method
  29.168 -     * of interface <code>DataInput</code> , which
  29.169 -     * will then return a <code>char</code> equal
  29.170 -     * to <code>(char)v</code>.
  29.171 -     *
  29.172 -     * @param      v   the <code>char</code> value to be written.
  29.173 -     * @throws     IOException  if an I/O error occurs.
  29.174 -     */
  29.175 -    void writeChar(int v) throws IOException;
  29.176 -
  29.177 -    /**
  29.178 -     * Writes an <code>int</code> value, which is
  29.179 -     * comprised of four bytes, to the output stream.
  29.180 -     * The byte values to be written, in the  order
  29.181 -     * shown, are:
  29.182 -     * <p><pre><code>
  29.183 -     * (byte)(0xff &amp; (v &gt;&gt; 24))
  29.184 -     * (byte)(0xff &amp; (v &gt;&gt; 16))
  29.185 -     * (byte)(0xff &amp; (v &gt;&gt; &#32; &#32;8))
  29.186 -     * (byte)(0xff &amp; v)
  29.187 -     * </code></pre><p>
  29.188 -     * The bytes written by this method may be read
  29.189 -     * by the <code>readInt</code> method of interface
  29.190 -     * <code>DataInput</code> , which will then
  29.191 -     * return an <code>int</code> equal to <code>v</code>.
  29.192 -     *
  29.193 -     * @param      v   the <code>int</code> value to be written.
  29.194 -     * @throws     IOException  if an I/O error occurs.
  29.195 -     */
  29.196 -    void writeInt(int v) throws IOException;
  29.197 -
  29.198 -    /**
  29.199 -     * Writes a <code>long</code> value, which is
  29.200 -     * comprised of eight bytes, to the output stream.
  29.201 -     * The byte values to be written, in the  order
  29.202 -     * shown, are:
  29.203 -     * <p><pre><code>
  29.204 -     * (byte)(0xff &amp; (v &gt;&gt; 56))
  29.205 -     * (byte)(0xff &amp; (v &gt;&gt; 48))
  29.206 -     * (byte)(0xff &amp; (v &gt;&gt; 40))
  29.207 -     * (byte)(0xff &amp; (v &gt;&gt; 32))
  29.208 -     * (byte)(0xff &amp; (v &gt;&gt; 24))
  29.209 -     * (byte)(0xff &amp; (v &gt;&gt; 16))
  29.210 -     * (byte)(0xff &amp; (v &gt;&gt;  8))
  29.211 -     * (byte)(0xff &amp; v)
  29.212 -     * </code></pre><p>
  29.213 -     * The bytes written by this method may be
  29.214 -     * read by the <code>readLong</code> method
  29.215 -     * of interface <code>DataInput</code> , which
  29.216 -     * will then return a <code>long</code> equal
  29.217 -     * to <code>v</code>.
  29.218 -     *
  29.219 -     * @param      v   the <code>long</code> value to be written.
  29.220 -     * @throws     IOException  if an I/O error occurs.
  29.221 -     */
  29.222 -    void writeLong(long v) throws IOException;
  29.223 -
  29.224 -    /**
  29.225 -     * Writes a <code>float</code> value,
  29.226 -     * which is comprised of four bytes, to the output stream.
  29.227 -     * It does this as if it first converts this
  29.228 -     * <code>float</code> value to an <code>int</code>
  29.229 -     * in exactly the manner of the <code>Float.floatToIntBits</code>
  29.230 -     * method  and then writes the <code>int</code>
  29.231 -     * value in exactly the manner of the  <code>writeInt</code>
  29.232 -     * method.  The bytes written by this method
  29.233 -     * may be read by the <code>readFloat</code>
  29.234 -     * method of interface <code>DataInput</code>,
  29.235 -     * which will then return a <code>float</code>
  29.236 -     * equal to <code>v</code>.
  29.237 -     *
  29.238 -     * @param      v   the <code>float</code> value to be written.
  29.239 -     * @throws     IOException  if an I/O error occurs.
  29.240 -     */
  29.241 -    void writeFloat(float v) throws IOException;
  29.242 -
  29.243 -    /**
  29.244 -     * Writes a <code>double</code> value,
  29.245 -     * which is comprised of eight bytes, to the output stream.
  29.246 -     * It does this as if it first converts this
  29.247 -     * <code>double</code> value to a <code>long</code>
  29.248 -     * in exactly the manner of the <code>Double.doubleToLongBits</code>
  29.249 -     * method  and then writes the <code>long</code>
  29.250 -     * value in exactly the manner of the  <code>writeLong</code>
  29.251 -     * method. The bytes written by this method
  29.252 -     * may be read by the <code>readDouble</code>
  29.253 -     * method of interface <code>DataInput</code>,
  29.254 -     * which will then return a <code>double</code>
  29.255 -     * equal to <code>v</code>.
  29.256 -     *
  29.257 -     * @param      v   the <code>double</code> value to be written.
  29.258 -     * @throws     IOException  if an I/O error occurs.
  29.259 -     */
  29.260 -    void writeDouble(double v) throws IOException;
  29.261 -
  29.262 -    /**
  29.263 -     * Writes a string to the output stream.
  29.264 -     * For every character in the string
  29.265 -     * <code>s</code>,  taken in order, one byte
  29.266 -     * is written to the output stream.  If
  29.267 -     * <code>s</code> is <code>null</code>, a <code>NullPointerException</code>
  29.268 -     * is thrown.<p>  If <code>s.length</code>
  29.269 -     * is zero, then no bytes are written. Otherwise,
  29.270 -     * the character <code>s[0]</code> is written
  29.271 -     * first, then <code>s[1]</code>, and so on;
  29.272 -     * the last character written is <code>s[s.length-1]</code>.
  29.273 -     * For each character, one byte is written,
  29.274 -     * the low-order byte, in exactly the manner
  29.275 -     * of the <code>writeByte</code> method . The
  29.276 -     * high-order eight bits of each character
  29.277 -     * in the string are ignored.
  29.278 -     *
  29.279 -     * @param      s   the string of bytes to be written.
  29.280 -     * @throws     IOException  if an I/O error occurs.
  29.281 -     */
  29.282 -    void writeBytes(String s) throws IOException;
  29.283 -
  29.284 -    /**
  29.285 -     * Writes every character in the string <code>s</code>,
  29.286 -     * to the output stream, in order,
  29.287 -     * two bytes per character. If <code>s</code>
  29.288 -     * is <code>null</code>, a <code>NullPointerException</code>
  29.289 -     * is thrown.  If <code>s.length</code>
  29.290 -     * is zero, then no characters are written.
  29.291 -     * Otherwise, the character <code>s[0]</code>
  29.292 -     * is written first, then <code>s[1]</code>,
  29.293 -     * and so on; the last character written is
  29.294 -     * <code>s[s.length-1]</code>. For each character,
  29.295 -     * two bytes are actually written, high-order
  29.296 -     * byte first, in exactly the manner of the
  29.297 -     * <code>writeChar</code> method.
  29.298 -     *
  29.299 -     * @param      s   the string value to be written.
  29.300 -     * @throws     IOException  if an I/O error occurs.
  29.301 -     */
  29.302 -    void writeChars(String s) throws IOException;
  29.303 -
  29.304 -    /**
  29.305 -     * Writes two bytes of length information
  29.306 -     * to the output stream, followed
  29.307 -     * by the
  29.308 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  29.309 -     * representation
  29.310 -     * of  every character in the string <code>s</code>.
  29.311 -     * If <code>s</code> is <code>null</code>,
  29.312 -     * a <code>NullPointerException</code> is thrown.
  29.313 -     * Each character in the string <code>s</code>
  29.314 -     * is converted to a group of one, two, or
  29.315 -     * three bytes, depending on the value of the
  29.316 -     * character.<p>
  29.317 -     * If a character <code>c</code>
  29.318 -     * is in the range <code>&#92;u0001</code> through
  29.319 -     * <code>&#92;u007f</code>, it is represented
  29.320 -     * by one byte:<p>
  29.321 -     * <pre>(byte)c </pre>  <p>
  29.322 -     * If a character <code>c</code> is <code>&#92;u0000</code>
  29.323 -     * or is in the range <code>&#92;u0080</code>
  29.324 -     * through <code>&#92;u07ff</code>, then it is
  29.325 -     * represented by two bytes, to be written
  29.326 -     * in the order shown:<p> <pre><code>
  29.327 -     * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
  29.328 -     * (byte)(0x80 | (0x3f &amp; c))
  29.329 -     *  </code></pre>  <p> If a character
  29.330 -     * <code>c</code> is in the range <code>&#92;u0800</code>
  29.331 -     * through <code>uffff</code>, then it is
  29.332 -     * represented by three bytes, to be written
  29.333 -     * in the order shown:<p> <pre><code>
  29.334 -     * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
  29.335 -     * (byte)(0x80 | (0x3f &amp; (c &gt;&gt;  6)))
  29.336 -     * (byte)(0x80 | (0x3f &amp; c))
  29.337 -     *  </code></pre>  <p> First,
  29.338 -     * the total number of bytes needed to represent
  29.339 -     * all the characters of <code>s</code> is
  29.340 -     * calculated. If this number is larger than
  29.341 -     * <code>65535</code>, then a <code>UTFDataFormatException</code>
  29.342 -     * is thrown. Otherwise, this length is written
  29.343 -     * to the output stream in exactly the manner
  29.344 -     * of the <code>writeShort</code> method;
  29.345 -     * after this, the one-, two-, or three-byte
  29.346 -     * representation of each character in the
  29.347 -     * string <code>s</code> is written.<p>  The
  29.348 -     * bytes written by this method may be read
  29.349 -     * by the <code>readUTF</code> method of interface
  29.350 -     * <code>DataInput</code> , which will then
  29.351 -     * return a <code>String</code> equal to <code>s</code>.
  29.352 -     *
  29.353 -     * @param      s   the string value to be written.
  29.354 -     * @throws     IOException  if an I/O error occurs.
  29.355 -     */
  29.356 -    void writeUTF(String s) throws IOException;
  29.357 -}
    30.1 --- a/emul/compact/src/main/java/java/io/DataOutputStream.java	Fri Mar 22 16:59:47 2013 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,416 +0,0 @@
    30.4 -/*
    30.5 - * Copyright (c) 1994, 2004, 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 - * A data output stream lets an application write primitive Java data
   30.33 - * types to an output stream in a portable way. An application can
   30.34 - * then use a data input stream to read the data back in.
   30.35 - *
   30.36 - * @author  unascribed
   30.37 - * @see     java.io.DataInputStream
   30.38 - * @since   JDK1.0
   30.39 - */
   30.40 -public
   30.41 -class DataOutputStream extends FilterOutputStream implements DataOutput {
   30.42 -    /**
   30.43 -     * The number of bytes written to the data output stream so far.
   30.44 -     * If this counter overflows, it will be wrapped to Integer.MAX_VALUE.
   30.45 -     */
   30.46 -    protected int written;
   30.47 -
   30.48 -    /**
   30.49 -     * bytearr is initialized on demand by writeUTF
   30.50 -     */
   30.51 -    private byte[] bytearr = null;
   30.52 -
   30.53 -    /**
   30.54 -     * Creates a new data output stream to write data to the specified
   30.55 -     * underlying output stream. The counter <code>written</code> is
   30.56 -     * set to zero.
   30.57 -     *
   30.58 -     * @param   out   the underlying output stream, to be saved for later
   30.59 -     *                use.
   30.60 -     * @see     java.io.FilterOutputStream#out
   30.61 -     */
   30.62 -    public DataOutputStream(OutputStream out) {
   30.63 -        super(out);
   30.64 -    }
   30.65 -
   30.66 -    /**
   30.67 -     * Increases the written counter by the specified value
   30.68 -     * until it reaches Integer.MAX_VALUE.
   30.69 -     */
   30.70 -    private void incCount(int value) {
   30.71 -        int temp = written + value;
   30.72 -        if (temp < 0) {
   30.73 -            temp = Integer.MAX_VALUE;
   30.74 -        }
   30.75 -        written = temp;
   30.76 -    }
   30.77 -
   30.78 -    /**
   30.79 -     * Writes the specified byte (the low eight bits of the argument
   30.80 -     * <code>b</code>) to the underlying output stream. If no exception
   30.81 -     * is thrown, the counter <code>written</code> is incremented by
   30.82 -     * <code>1</code>.
   30.83 -     * <p>
   30.84 -     * Implements the <code>write</code> method of <code>OutputStream</code>.
   30.85 -     *
   30.86 -     * @param      b   the <code>byte</code> to be written.
   30.87 -     * @exception  IOException  if an I/O error occurs.
   30.88 -     * @see        java.io.FilterOutputStream#out
   30.89 -     */
   30.90 -    public synchronized void write(int b) throws IOException {
   30.91 -        out.write(b);
   30.92 -        incCount(1);
   30.93 -    }
   30.94 -
   30.95 -    /**
   30.96 -     * Writes <code>len</code> bytes from the specified byte array
   30.97 -     * starting at offset <code>off</code> to the underlying output stream.
   30.98 -     * If no exception is thrown, the counter <code>written</code> is
   30.99 -     * incremented by <code>len</code>.
  30.100 -     *
  30.101 -     * @param      b     the data.
  30.102 -     * @param      off   the start offset in the data.
  30.103 -     * @param      len   the number of bytes to write.
  30.104 -     * @exception  IOException  if an I/O error occurs.
  30.105 -     * @see        java.io.FilterOutputStream#out
  30.106 -     */
  30.107 -    public synchronized void write(byte b[], int off, int len)
  30.108 -        throws IOException
  30.109 -    {
  30.110 -        out.write(b, off, len);
  30.111 -        incCount(len);
  30.112 -    }
  30.113 -
  30.114 -    /**
  30.115 -     * Flushes this data output stream. This forces any buffered output
  30.116 -     * bytes to be written out to the stream.
  30.117 -     * <p>
  30.118 -     * The <code>flush</code> method of <code>DataOutputStream</code>
  30.119 -     * calls the <code>flush</code> method of its underlying output stream.
  30.120 -     *
  30.121 -     * @exception  IOException  if an I/O error occurs.
  30.122 -     * @see        java.io.FilterOutputStream#out
  30.123 -     * @see        java.io.OutputStream#flush()
  30.124 -     */
  30.125 -    public void flush() throws IOException {
  30.126 -        out.flush();
  30.127 -    }
  30.128 -
  30.129 -    /**
  30.130 -     * Writes a <code>boolean</code> to the underlying output stream as
  30.131 -     * a 1-byte value. The value <code>true</code> is written out as the
  30.132 -     * value <code>(byte)1</code>; the value <code>false</code> is
  30.133 -     * written out as the value <code>(byte)0</code>. If no exception is
  30.134 -     * thrown, the counter <code>written</code> is incremented by
  30.135 -     * <code>1</code>.
  30.136 -     *
  30.137 -     * @param      v   a <code>boolean</code> value to be written.
  30.138 -     * @exception  IOException  if an I/O error occurs.
  30.139 -     * @see        java.io.FilterOutputStream#out
  30.140 -     */
  30.141 -    public final void writeBoolean(boolean v) throws IOException {
  30.142 -        out.write(v ? 1 : 0);
  30.143 -        incCount(1);
  30.144 -    }
  30.145 -
  30.146 -    /**
  30.147 -     * Writes out a <code>byte</code> to the underlying output stream as
  30.148 -     * a 1-byte value. If no exception is thrown, the counter
  30.149 -     * <code>written</code> is incremented by <code>1</code>.
  30.150 -     *
  30.151 -     * @param      v   a <code>byte</code> value to be written.
  30.152 -     * @exception  IOException  if an I/O error occurs.
  30.153 -     * @see        java.io.FilterOutputStream#out
  30.154 -     */
  30.155 -    public final void writeByte(int v) throws IOException {
  30.156 -        out.write(v);
  30.157 -        incCount(1);
  30.158 -    }
  30.159 -
  30.160 -    /**
  30.161 -     * Writes a <code>short</code> to the underlying output stream as two
  30.162 -     * bytes, high byte first. If no exception is thrown, the counter
  30.163 -     * <code>written</code> is incremented by <code>2</code>.
  30.164 -     *
  30.165 -     * @param      v   a <code>short</code> to be written.
  30.166 -     * @exception  IOException  if an I/O error occurs.
  30.167 -     * @see        java.io.FilterOutputStream#out
  30.168 -     */
  30.169 -    public final void writeShort(int v) throws IOException {
  30.170 -        out.write((v >>> 8) & 0xFF);
  30.171 -        out.write((v >>> 0) & 0xFF);
  30.172 -        incCount(2);
  30.173 -    }
  30.174 -
  30.175 -    /**
  30.176 -     * Writes a <code>char</code> to the underlying output stream as a
  30.177 -     * 2-byte value, high byte first. If no exception is thrown, the
  30.178 -     * counter <code>written</code> is incremented by <code>2</code>.
  30.179 -     *
  30.180 -     * @param      v   a <code>char</code> value to be written.
  30.181 -     * @exception  IOException  if an I/O error occurs.
  30.182 -     * @see        java.io.FilterOutputStream#out
  30.183 -     */
  30.184 -    public final void writeChar(int v) throws IOException {
  30.185 -        out.write((v >>> 8) & 0xFF);
  30.186 -        out.write((v >>> 0) & 0xFF);
  30.187 -        incCount(2);
  30.188 -    }
  30.189 -
  30.190 -    /**
  30.191 -     * Writes an <code>int</code> to the underlying output stream as four
  30.192 -     * bytes, high byte first. If no exception is thrown, the counter
  30.193 -     * <code>written</code> is incremented by <code>4</code>.
  30.194 -     *
  30.195 -     * @param      v   an <code>int</code> to be written.
  30.196 -     * @exception  IOException  if an I/O error occurs.
  30.197 -     * @see        java.io.FilterOutputStream#out
  30.198 -     */
  30.199 -    public final void writeInt(int v) throws IOException {
  30.200 -        out.write((v >>> 24) & 0xFF);
  30.201 -        out.write((v >>> 16) & 0xFF);
  30.202 -        out.write((v >>>  8) & 0xFF);
  30.203 -        out.write((v >>>  0) & 0xFF);
  30.204 -        incCount(4);
  30.205 -    }
  30.206 -
  30.207 -    private byte writeBuffer[] = new byte[8];
  30.208 -
  30.209 -    /**
  30.210 -     * Writes a <code>long</code> to the underlying output stream as eight
  30.211 -     * bytes, high byte first. In no exception is thrown, the counter
  30.212 -     * <code>written</code> is incremented by <code>8</code>.
  30.213 -     *
  30.214 -     * @param      v   a <code>long</code> to be written.
  30.215 -     * @exception  IOException  if an I/O error occurs.
  30.216 -     * @see        java.io.FilterOutputStream#out
  30.217 -     */
  30.218 -    public final void writeLong(long v) throws IOException {
  30.219 -        writeBuffer[0] = (byte)(v >>> 56);
  30.220 -        writeBuffer[1] = (byte)(v >>> 48);
  30.221 -        writeBuffer[2] = (byte)(v >>> 40);
  30.222 -        writeBuffer[3] = (byte)(v >>> 32);
  30.223 -        writeBuffer[4] = (byte)(v >>> 24);
  30.224 -        writeBuffer[5] = (byte)(v >>> 16);
  30.225 -        writeBuffer[6] = (byte)(v >>>  8);
  30.226 -        writeBuffer[7] = (byte)(v >>>  0);
  30.227 -        out.write(writeBuffer, 0, 8);
  30.228 -        incCount(8);
  30.229 -    }
  30.230 -
  30.231 -    /**
  30.232 -     * Converts the float argument to an <code>int</code> using the
  30.233 -     * <code>floatToIntBits</code> method in class <code>Float</code>,
  30.234 -     * and then writes that <code>int</code> value to the underlying
  30.235 -     * output stream as a 4-byte quantity, high byte first. If no
  30.236 -     * exception is thrown, the counter <code>written</code> is
  30.237 -     * incremented by <code>4</code>.
  30.238 -     *
  30.239 -     * @param      v   a <code>float</code> value to be written.
  30.240 -     * @exception  IOException  if an I/O error occurs.
  30.241 -     * @see        java.io.FilterOutputStream#out
  30.242 -     * @see        java.lang.Float#floatToIntBits(float)
  30.243 -     */
  30.244 -    public final void writeFloat(float v) throws IOException {
  30.245 -        writeInt(Float.floatToIntBits(v));
  30.246 -    }
  30.247 -
  30.248 -    /**
  30.249 -     * Converts the double argument to a <code>long</code> using the
  30.250 -     * <code>doubleToLongBits</code> method in class <code>Double</code>,
  30.251 -     * and then writes that <code>long</code> value to the underlying
  30.252 -     * output stream as an 8-byte quantity, high byte first. If no
  30.253 -     * exception is thrown, the counter <code>written</code> is
  30.254 -     * incremented by <code>8</code>.
  30.255 -     *
  30.256 -     * @param      v   a <code>double</code> value to be written.
  30.257 -     * @exception  IOException  if an I/O error occurs.
  30.258 -     * @see        java.io.FilterOutputStream#out
  30.259 -     * @see        java.lang.Double#doubleToLongBits(double)
  30.260 -     */
  30.261 -    public final void writeDouble(double v) throws IOException {
  30.262 -        writeLong(Double.doubleToLongBits(v));
  30.263 -    }
  30.264 -
  30.265 -    /**
  30.266 -     * Writes out the string to the underlying output stream as a
  30.267 -     * sequence of bytes. Each character in the string is written out, in
  30.268 -     * sequence, by discarding its high eight bits. If no exception is
  30.269 -     * thrown, the counter <code>written</code> is incremented by the
  30.270 -     * length of <code>s</code>.
  30.271 -     *
  30.272 -     * @param      s   a string of bytes to be written.
  30.273 -     * @exception  IOException  if an I/O error occurs.
  30.274 -     * @see        java.io.FilterOutputStream#out
  30.275 -     */
  30.276 -    public final void writeBytes(String s) throws IOException {
  30.277 -        int len = s.length();
  30.278 -        for (int i = 0 ; i < len ; i++) {
  30.279 -            out.write((byte)s.charAt(i));
  30.280 -        }
  30.281 -        incCount(len);
  30.282 -    }
  30.283 -
  30.284 -    /**
  30.285 -     * Writes a string to the underlying output stream as a sequence of
  30.286 -     * characters. Each character is written to the data output stream as
  30.287 -     * if by the <code>writeChar</code> method. If no exception is
  30.288 -     * thrown, the counter <code>written</code> is incremented by twice
  30.289 -     * the length of <code>s</code>.
  30.290 -     *
  30.291 -     * @param      s   a <code>String</code> value to be written.
  30.292 -     * @exception  IOException  if an I/O error occurs.
  30.293 -     * @see        java.io.DataOutputStream#writeChar(int)
  30.294 -     * @see        java.io.FilterOutputStream#out
  30.295 -     */
  30.296 -    public final void writeChars(String s) throws IOException {
  30.297 -        int len = s.length();
  30.298 -        for (int i = 0 ; i < len ; i++) {
  30.299 -            int v = s.charAt(i);
  30.300 -            out.write((v >>> 8) & 0xFF);
  30.301 -            out.write((v >>> 0) & 0xFF);
  30.302 -        }
  30.303 -        incCount(len * 2);
  30.304 -    }
  30.305 -
  30.306 -    /**
  30.307 -     * Writes a string to the underlying output stream using
  30.308 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  30.309 -     * encoding in a machine-independent manner.
  30.310 -     * <p>
  30.311 -     * First, two bytes are written to the output stream as if by the
  30.312 -     * <code>writeShort</code> method giving the number of bytes to
  30.313 -     * follow. This value is the number of bytes actually written out,
  30.314 -     * not the length of the string. Following the length, each character
  30.315 -     * of the string is output, in sequence, using the modified UTF-8 encoding
  30.316 -     * for the character. If no exception is thrown, the counter
  30.317 -     * <code>written</code> is incremented by the total number of
  30.318 -     * bytes written to the output stream. This will be at least two
  30.319 -     * plus the length of <code>str</code>, and at most two plus
  30.320 -     * thrice the length of <code>str</code>.
  30.321 -     *
  30.322 -     * @param      str   a string to be written.
  30.323 -     * @exception  IOException  if an I/O error occurs.
  30.324 -     */
  30.325 -    public final void writeUTF(String str) throws IOException {
  30.326 -        writeUTF(str, this);
  30.327 -    }
  30.328 -
  30.329 -    /**
  30.330 -     * Writes a string to the specified DataOutput using
  30.331 -     * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  30.332 -     * encoding in a machine-independent manner.
  30.333 -     * <p>
  30.334 -     * First, two bytes are written to out as if by the <code>writeShort</code>
  30.335 -     * method giving the number of bytes to follow. This value is the number of
  30.336 -     * bytes actually written out, not the length of the string. Following the
  30.337 -     * length, each character of the string is output, in sequence, using the
  30.338 -     * modified UTF-8 encoding for the character. If no exception is thrown, the
  30.339 -     * counter <code>written</code> is incremented by the total number of
  30.340 -     * bytes written to the output stream. This will be at least two
  30.341 -     * plus the length of <code>str</code>, and at most two plus
  30.342 -     * thrice the length of <code>str</code>.
  30.343 -     *
  30.344 -     * @param      str   a string to be written.
  30.345 -     * @param      out   destination to write to
  30.346 -     * @return     The number of bytes written out.
  30.347 -     * @exception  IOException  if an I/O error occurs.
  30.348 -     */
  30.349 -    static int writeUTF(String str, DataOutput out) throws IOException {
  30.350 -        int strlen = str.length();
  30.351 -        int utflen = 0;
  30.352 -        int c, count = 0;
  30.353 -
  30.354 -        /* use charAt instead of copying String to char array */
  30.355 -        for (int i = 0; i < strlen; i++) {
  30.356 -            c = str.charAt(i);
  30.357 -            if ((c >= 0x0001) && (c <= 0x007F)) {
  30.358 -                utflen++;
  30.359 -            } else if (c > 0x07FF) {
  30.360 -                utflen += 3;
  30.361 -            } else {
  30.362 -                utflen += 2;
  30.363 -            }
  30.364 -        }
  30.365 -
  30.366 -        if (utflen > 65535)
  30.367 -            throw new UTFDataFormatException(
  30.368 -                "encoded string too long: " + utflen + " bytes");
  30.369 -
  30.370 -        byte[] bytearr = null;
  30.371 -        if (out instanceof DataOutputStream) {
  30.372 -            DataOutputStream dos = (DataOutputStream)out;
  30.373 -            if(dos.bytearr == null || (dos.bytearr.length < (utflen+2)))
  30.374 -                dos.bytearr = new byte[(utflen*2) + 2];
  30.375 -            bytearr = dos.bytearr;
  30.376 -        } else {
  30.377 -            bytearr = new byte[utflen+2];
  30.378 -        }
  30.379 -
  30.380 -        bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF);
  30.381 -        bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF);
  30.382 -
  30.383 -        int i=0;
  30.384 -        for (i=0; i<strlen; i++) {
  30.385 -           c = str.charAt(i);
  30.386 -           if (!((c >= 0x0001) && (c <= 0x007F))) break;
  30.387 -           bytearr[count++] = (byte) c;
  30.388 -        }
  30.389 -
  30.390 -        for (;i < strlen; i++){
  30.391 -            c = str.charAt(i);
  30.392 -            if ((c >= 0x0001) && (c <= 0x007F)) {
  30.393 -                bytearr[count++] = (byte) c;
  30.394 -
  30.395 -            } else if (c > 0x07FF) {
  30.396 -                bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
  30.397 -                bytearr[count++] = (byte) (0x80 | ((c >>  6) & 0x3F));
  30.398 -                bytearr[count++] = (byte) (0x80 | ((c >>  0) & 0x3F));
  30.399 -            } else {
  30.400 -                bytearr[count++] = (byte) (0xC0 | ((c >>  6) & 0x1F));
  30.401 -                bytearr[count++] = (byte) (0x80 | ((c >>  0) & 0x3F));
  30.402 -            }
  30.403 -        }
  30.404 -        out.write(bytearr, 0, utflen+2);
  30.405 -        return utflen + 2;
  30.406 -    }
  30.407 -
  30.408 -    /**
  30.409 -     * Returns the current value of the counter <code>written</code>,
  30.410 -     * the number of bytes written to this data output stream so far.
  30.411 -     * If the counter overflows, it will be wrapped to Integer.MAX_VALUE.
  30.412 -     *
  30.413 -     * @return  the value of the <code>written</code> field.
  30.414 -     * @see     java.io.DataOutputStream#written
  30.415 -     */
  30.416 -    public final int size() {
  30.417 -        return written;
  30.418 -    }
  30.419 -}
    31.1 --- a/emul/compact/src/main/java/java/io/Externalizable.java	Fri Mar 22 16:59:47 2013 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,97 +0,0 @@
    31.4 -/*
    31.5 - * Copyright (c) 1996, 2004, 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 -import java.io.ObjectOutput;
   31.32 -import java.io.ObjectInput;
   31.33 -
   31.34 -/**
   31.35 - * Only the identity of the class of an Externalizable instance is
   31.36 - * written in the serialization stream and it is the responsibility
   31.37 - * of the class to save and restore the contents of its instances.
   31.38 - *
   31.39 - * The writeExternal and readExternal methods of the Externalizable
   31.40 - * interface are implemented by a class to give the class complete
   31.41 - * control over the format and contents of the stream for an object
   31.42 - * and its supertypes. These methods must explicitly
   31.43 - * coordinate with the supertype to save its state. These methods supersede
   31.44 - * customized implementations of writeObject and readObject methods.<br>
   31.45 - *
   31.46 - * Object Serialization uses the Serializable and Externalizable
   31.47 - * interfaces.  Object persistence mechanisms can use them as well.  Each
   31.48 - * object to be stored is tested for the Externalizable interface. If
   31.49 - * the object supports Externalizable, the writeExternal method is called. If the
   31.50 - * object does not support Externalizable and does implement
   31.51 - * Serializable, the object is saved using
   31.52 - * ObjectOutputStream. <br> When an Externalizable object is
   31.53 - * reconstructed, an instance is created using the public no-arg
   31.54 - * constructor, then the readExternal method called.  Serializable
   31.55 - * objects are restored by reading them from an ObjectInputStream.<br>
   31.56 - *
   31.57 - * An Externalizable instance can designate a substitution object via
   31.58 - * the writeReplace and readResolve methods documented in the Serializable
   31.59 - * interface.<br>
   31.60 - *
   31.61 - * @author  unascribed
   31.62 - * @see java.io.ObjectOutputStream
   31.63 - * @see java.io.ObjectInputStream
   31.64 - * @see java.io.ObjectOutput
   31.65 - * @see java.io.ObjectInput
   31.66 - * @see java.io.Serializable
   31.67 - * @since   JDK1.1
   31.68 - */
   31.69 -public interface Externalizable extends java.io.Serializable {
   31.70 -    /**
   31.71 -     * The object implements the writeExternal method to save its contents
   31.72 -     * by calling the methods of DataOutput for its primitive values or
   31.73 -     * calling the writeObject method of ObjectOutput for objects, strings,
   31.74 -     * and arrays.
   31.75 -     *
   31.76 -     * @serialData Overriding methods should use this tag to describe
   31.77 -     *             the data layout of this Externalizable object.
   31.78 -     *             List the sequence of element types and, if possible,
   31.79 -     *             relate the element to a public/protected field and/or
   31.80 -     *             method of this Externalizable class.
   31.81 -     *
   31.82 -     * @param out the stream to write the object to
   31.83 -     * @exception IOException Includes any I/O exceptions that may occur
   31.84 -     */
   31.85 -    void writeExternal(ObjectOutput out) throws IOException;
   31.86 -
   31.87 -    /**
   31.88 -     * The object implements the readExternal method to restore its
   31.89 -     * contents by calling the methods of DataInput for primitive
   31.90 -     * types and readObject for objects, strings and arrays.  The
   31.91 -     * readExternal method must read the values in the same sequence
   31.92 -     * and with the same types as were written by writeExternal.
   31.93 -     *
   31.94 -     * @param in the stream to read data from in order to restore the object
   31.95 -     * @exception IOException if I/O errors occur
   31.96 -     * @exception ClassNotFoundException If the class for an object being
   31.97 -     *              restored cannot be found.
   31.98 -     */
   31.99 -    void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
  31.100 -}
    32.1 --- a/emul/compact/src/main/java/java/io/FilterOutputStream.java	Fri Mar 22 16:59:47 2013 +0100
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,162 +0,0 @@
    32.4 -/*
    32.5 - * Copyright (c) 1994, 2011, 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 - * This class is the superclass of all classes that filter output
   32.33 - * streams. These streams sit on top of an already existing output
   32.34 - * stream (the <i>underlying</i> output stream) which it uses as its
   32.35 - * basic sink of data, but possibly transforming the data along the
   32.36 - * way or providing additional functionality.
   32.37 - * <p>
   32.38 - * The class <code>FilterOutputStream</code> itself simply overrides
   32.39 - * all methods of <code>OutputStream</code> with versions that pass
   32.40 - * all requests to the underlying output stream. Subclasses of
   32.41 - * <code>FilterOutputStream</code> may further override some of these
   32.42 - * methods as well as provide additional methods and fields.
   32.43 - *
   32.44 - * @author  Jonathan Payne
   32.45 - * @since   JDK1.0
   32.46 - */
   32.47 -public
   32.48 -class FilterOutputStream extends OutputStream {
   32.49 -    /**
   32.50 -     * The underlying output stream to be filtered.
   32.51 -     */
   32.52 -    protected OutputStream out;
   32.53 -
   32.54 -    /**
   32.55 -     * Creates an output stream filter built on top of the specified
   32.56 -     * underlying output stream.
   32.57 -     *
   32.58 -     * @param   out   the underlying output stream to be assigned to
   32.59 -     *                the field <tt>this.out</tt> for later use, or
   32.60 -     *                <code>null</code> if this instance is to be
   32.61 -     *                created without an underlying stream.
   32.62 -     */
   32.63 -    public FilterOutputStream(OutputStream out) {
   32.64 -        this.out = out;
   32.65 -    }
   32.66 -
   32.67 -    /**
   32.68 -     * Writes the specified <code>byte</code> to this output stream.
   32.69 -     * <p>
   32.70 -     * The <code>write</code> method of <code>FilterOutputStream</code>
   32.71 -     * calls the <code>write</code> method of its underlying output stream,
   32.72 -     * that is, it performs <tt>out.write(b)</tt>.
   32.73 -     * <p>
   32.74 -     * Implements the abstract <tt>write</tt> method of <tt>OutputStream</tt>.
   32.75 -     *
   32.76 -     * @param      b   the <code>byte</code>.
   32.77 -     * @exception  IOException  if an I/O error occurs.
   32.78 -     */
   32.79 -    public void write(int b) throws IOException {
   32.80 -        out.write(b);
   32.81 -    }
   32.82 -
   32.83 -    /**
   32.84 -     * Writes <code>b.length</code> bytes to this output stream.
   32.85 -     * <p>
   32.86 -     * The <code>write</code> method of <code>FilterOutputStream</code>
   32.87 -     * calls its <code>write</code> method of three arguments with the
   32.88 -     * arguments <code>b</code>, <code>0</code>, and
   32.89 -     * <code>b.length</code>.
   32.90 -     * <p>
   32.91 -     * Note that this method does not call the one-argument
   32.92 -     * <code>write</code> method of its underlying stream with the single
   32.93 -     * argument <code>b</code>.
   32.94 -     *
   32.95 -     * @param      b   the data to be written.
   32.96 -     * @exception  IOException  if an I/O error occurs.
   32.97 -     * @see        java.io.FilterOutputStream#write(byte[], int, int)
   32.98 -     */
   32.99 -    public void write(byte b[]) throws IOException {
  32.100 -        write(b, 0, b.length);
  32.101 -    }
  32.102 -
  32.103 -    /**
  32.104 -     * Writes <code>len</code> bytes from the specified
  32.105 -     * <code>byte</code> array starting at offset <code>off</code> to
  32.106 -     * this output stream.
  32.107 -     * <p>
  32.108 -     * The <code>write</code> method of <code>FilterOutputStream</code>
  32.109 -     * calls the <code>write</code> method of one argument on each
  32.110 -     * <code>byte</code> to output.
  32.111 -     * <p>
  32.112 -     * Note that this method does not call the <code>write</code> method
  32.113 -     * of its underlying input stream with the same arguments. Subclasses
  32.114 -     * of <code>FilterOutputStream</code> should provide a more efficient
  32.115 -     * implementation of this method.
  32.116 -     *
  32.117 -     * @param      b     the data.
  32.118 -     * @param      off   the start offset in the data.
  32.119 -     * @param      len   the number of bytes to write.
  32.120 -     * @exception  IOException  if an I/O error occurs.
  32.121 -     * @see        java.io.FilterOutputStream#write(int)
  32.122 -     */
  32.123 -    public void write(byte b[], int off, int len) throws IOException {
  32.124 -        if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
  32.125 -            throw new IndexOutOfBoundsException();
  32.126 -
  32.127 -        for (int i = 0 ; i < len ; i++) {
  32.128 -            write(b[off + i]);
  32.129 -        }
  32.130 -    }
  32.131 -
  32.132 -    /**
  32.133 -     * Flushes this output stream and forces any buffered output bytes
  32.134 -     * to be written out to the stream.
  32.135 -     * <p>
  32.136 -     * The <code>flush</code> method of <code>FilterOutputStream</code>
  32.137 -     * calls the <code>flush</code> method of its underlying output stream.
  32.138 -     *
  32.139 -     * @exception  IOException  if an I/O error occurs.
  32.140 -     * @see        java.io.FilterOutputStream#out
  32.141 -     */
  32.142 -    public void flush() throws IOException {
  32.143 -        out.flush();
  32.144 -    }
  32.145 -
  32.146 -    /**
  32.147 -     * Closes this output stream and releases any system resources
  32.148 -     * associated with the stream.
  32.149 -     * <p>
  32.150 -     * The <code>close</code> method of <code>FilterOutputStream</code>
  32.151 -     * calls its <code>flush</code> method, and then calls the
  32.152 -     * <code>close</code> method of its underlying output stream.
  32.153 -     *
  32.154 -     * @exception  IOException  if an I/O error occurs.
  32.155 -     * @see        java.io.FilterOutputStream#flush()
  32.156 -     * @see        java.io.FilterOutputStream#out
  32.157 -     */
  32.158 -    public void close() throws IOException {
  32.159 -        try {
  32.160 -          flush();
  32.161 -        } catch (IOException ignored) {
  32.162 -        }
  32.163 -        out.close();
  32.164 -    }
  32.165 -}
    33.1 --- a/emul/compact/src/main/java/java/io/Flushable.java	Fri Mar 22 16:59:47 2013 +0100
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,47 +0,0 @@
    33.4 -/*
    33.5 - * Copyright (c) 2004, 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 -import java.io.IOException;
   33.32 -
   33.33 -/**
   33.34 - * A <tt>Flushable</tt> is a destination of data that can be flushed.  The
   33.35 - * flush method is invoked to write any buffered output to the underlying
   33.36 - * stream.
   33.37 - *
   33.38 - * @since 1.5
   33.39 - */
   33.40 -
   33.41 -public interface Flushable {
   33.42 -
   33.43 -    /**
   33.44 -     * Flushes this stream by writing any buffered output to the underlying
   33.45 -     * stream.
   33.46 -     *
   33.47 -     * @throws IOException If an I/O error occurs
   33.48 -     */
   33.49 -    void flush() throws IOException;
   33.50 -}
    34.1 --- a/emul/compact/src/main/java/java/io/InputStreamReader.java	Fri Mar 22 16:59:47 2013 +0100
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,230 +0,0 @@
    34.4 -/*
    34.5 - * Copyright (c) 1996, 2005, 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 -
   34.32 -/**
   34.33 - * An InputStreamReader is a bridge from byte streams to character streams: It
   34.34 - * reads bytes and decodes them into characters using a specified {@link
   34.35 - * java.nio.charset.Charset <code>charset</code>}.  The charset that it uses
   34.36 - * may be specified by name or may be given explicitly, or the platform's
   34.37 - * default charset may be accepted.
   34.38 - *
   34.39 - * <p> Each invocation of one of an InputStreamReader's read() methods may
   34.40 - * cause one or more bytes to be read from the underlying byte-input stream.
   34.41 - * To enable the efficient conversion of bytes to characters, more bytes may
   34.42 - * be read ahead from the underlying stream than are necessary to satisfy the
   34.43 - * current read operation.
   34.44 - *
   34.45 - * <p> For top efficiency, consider wrapping an InputStreamReader within a
   34.46 - * BufferedReader.  For example:
   34.47 - *
   34.48 - * <pre>
   34.49 - * BufferedReader in
   34.50 - *   = new BufferedReader(new InputStreamReader(System.in));
   34.51 - * </pre>
   34.52 - *
   34.53 - * @see BufferedReader
   34.54 - * @see InputStream
   34.55 - * @see java.nio.charset.Charset
   34.56 - *
   34.57 - * @author      Mark Reinhold
   34.58 - * @since       JDK1.1
   34.59 - */
   34.60 -
   34.61 -public class InputStreamReader extends Reader {
   34.62 -
   34.63 -    /**
   34.64 -     * Creates an InputStreamReader that uses the default charset.
   34.65 -     *
   34.66 -     * @param  in   An InputStream
   34.67 -     */
   34.68 -    public InputStreamReader(InputStream in) {
   34.69 -        super(in);
   34.70 -    }
   34.71 -
   34.72 -    /**
   34.73 -     * Creates an InputStreamReader that uses the named charset.
   34.74 -     *
   34.75 -     * @param  in
   34.76 -     *         An InputStream
   34.77 -     *
   34.78 -     * @param  charsetName
   34.79 -     *         The name of a supported
   34.80 -     *         {@link java.nio.charset.Charset </code>charset<code>}
   34.81 -     *
   34.82 -     * @exception  UnsupportedEncodingException
   34.83 -     *             If the named charset is not supported
   34.84 -     */
   34.85 -    public InputStreamReader(InputStream in, String charsetName)
   34.86 -        throws UnsupportedEncodingException
   34.87 -    {
   34.88 -        super(in);
   34.89 -        if (!charsetName.toUpperCase().equals("UTF-8")) {
   34.90 -            throw new UnsupportedEncodingException(charsetName);
   34.91 -        }
   34.92 -    }
   34.93 -
   34.94 -    /**
   34.95 -     * Creates an InputStreamReader that uses the given charset. </p>
   34.96 -     *
   34.97 -     * @param  in       An InputStream
   34.98 -     * @param  cs       A charset
   34.99 -     *
  34.100 -     * @since 1.4
  34.101 -     * @spec JSR-51
  34.102 -     */
  34.103 -/* XXX:
  34.104 -    public InputStreamReader(InputStream in, Charset cs) {
  34.105 -        super(in);
  34.106 -        if (cs == null)
  34.107 -            throw new NullPointerException("charset");
  34.108 -        sd = StreamDecoder.forInputStreamReader(in, this, cs);
  34.109 -    }
  34.110 -*/
  34.111 -    /**
  34.112 -     * Creates an InputStreamReader that uses the given charset decoder.  </p>
  34.113 -     *
  34.114 -     * @param  in       An InputStream
  34.115 -     * @param  dec      A charset decoder
  34.116 -     *
  34.117 -     * @since 1.4
  34.118 -     * @spec JSR-51
  34.119 -     */
  34.120 -/* XXX:
  34.121 -    public InputStreamReader(InputStream in, CharsetDecoder dec) {
  34.122 -        super(in);
  34.123 -        if (dec == null)
  34.124 -            throw new NullPointerException("charset decoder");
  34.125 -        sd = StreamDecoder.forInputStreamReader(in, this, dec);
  34.126 -    }
  34.127 -*/
  34.128 -    
  34.129 -    /**
  34.130 -     * Returns the name of the character encoding being used by this stream.
  34.131 -     *
  34.132 -     * <p> If the encoding has an historical name then that name is returned;
  34.133 -     * otherwise the encoding's canonical name is returned.
  34.134 -     *
  34.135 -     * <p> If this instance was created with the {@link
  34.136 -     * #InputStreamReader(InputStream, String)} constructor then the returned
  34.137 -     * name, being unique for the encoding, may differ from the name passed to
  34.138 -     * the constructor. This method will return <code>null</code> if the
  34.139 -     * stream has been closed.
  34.140 -     * </p>
  34.141 -     * @return The historical name of this encoding, or
  34.142 -     *         <code>null</code> if the stream has been closed
  34.143 -     *
  34.144 -     * @see java.nio.charset.Charset
  34.145 -     *
  34.146 -     * @revised 1.4
  34.147 -     * @spec JSR-51
  34.148 -     */
  34.149 -    public String getEncoding() {
  34.150 -        return "UTF-8";
  34.151 -    }
  34.152 -
  34.153 -    /**
  34.154 -     * Reads a single character.
  34.155 -     *
  34.156 -     * @return The character read, or -1 if the end of the stream has been
  34.157 -     *         reached
  34.158 -     *
  34.159 -     * @exception  IOException  If an I/O error occurs
  34.160 -     */
  34.161 -    public int read() throws IOException {
  34.162 -        final InputStream is = (InputStream)lock;
  34.163 -        int c = is.read();
  34.164 -        if (c == -1) {
  34.165 -            return -1;
  34.166 -        }
  34.167 -        c = (int) c & 0xff;
  34.168 -        switch (c >> 4) {
  34.169 -            case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
  34.170 -                /* 0xxxxxxx*/
  34.171 -                return c;
  34.172 -            case 12: case 13: {
  34.173 -                /* 110x xxxx   10xx xxxx*/
  34.174 -                int char2 = (int) is.read();
  34.175 -                if ((char2 & 0xC0) != 0x80)
  34.176 -                    throw new UTFDataFormatException("malformed input");
  34.177 -                return (((c & 0x1F) << 6) | (char2 & 0x3F));
  34.178 -            }
  34.179 -            case 14: {
  34.180 -                /* 1110 xxxx  10xx xxxx  10xx xxxx */
  34.181 -                int char2 = is.read();
  34.182 -                int char3 = is.read();
  34.183 -                if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80))
  34.184 -                    throw new UTFDataFormatException("malformed input");
  34.185 -                return (((c    & 0x0F) << 12) |
  34.186 -                       ((char2 & 0x3F) << 6)  |
  34.187 -                       ((char3 & 0x3F) << 0));
  34.188 -            }
  34.189 -            default:
  34.190 -                /* 10xx xxxx,  1111 xxxx */
  34.191 -                throw new UTFDataFormatException("malformed input");
  34.192 -        }
  34.193 -    }
  34.194 -    
  34.195 -    /**
  34.196 -     * Reads characters into a portion of an array.
  34.197 -     *
  34.198 -     * @param      cbuf     Destination buffer
  34.199 -     * @param      offset   Offset at which to start storing characters
  34.200 -     * @param      length   Maximum number of characters to read
  34.201 -     *
  34.202 -     * @return     The number of characters read, or -1 if the end of the
  34.203 -     *             stream has been reached
  34.204 -     *
  34.205 -     * @exception  IOException  If an I/O error occurs
  34.206 -     */
  34.207 -    public int read(char cbuf[], int offset, int length) throws IOException {
  34.208 -        for (int i = 0; i < length; i++) {
  34.209 -            int ch = read();
  34.210 -            if (ch == -1) {
  34.211 -                if (i == 0) return -1;
  34.212 -                return i;
  34.213 -            }
  34.214 -            cbuf[offset++] = (char) ch;
  34.215 -        }
  34.216 -        return length;
  34.217 -    }
  34.218 -
  34.219 -    /**
  34.220 -     * Tells whether this stream is ready to be read.  An InputStreamReader is
  34.221 -     * ready if its input buffer is not empty, or if bytes are available to be
  34.222 -     * read from the underlying byte stream.
  34.223 -     *
  34.224 -     * @exception  IOException  If an I/O error occurs
  34.225 -     */
  34.226 -    public boolean ready() throws IOException {
  34.227 -        return ((InputStream)lock).available() > 0;
  34.228 -    }
  34.229 -
  34.230 -    public void close() throws IOException {
  34.231 -        ((InputStream)lock).close();
  34.232 -    }
  34.233 -}
    35.1 --- a/emul/compact/src/main/java/java/io/InvalidClassException.java	Fri Mar 22 16:59:47 2013 +0100
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,81 +0,0 @@
    35.4 -/*
    35.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
    35.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 - *
    35.8 - * This code is free software; you can redistribute it and/or modify it
    35.9 - * under the terms of the GNU General Public License version 2 only, as
   35.10 - * published by the Free Software Foundation.  Oracle designates this
   35.11 - * particular file as subject to the "Classpath" exception as provided
   35.12 - * by Oracle in the LICENSE file that accompanied this code.
   35.13 - *
   35.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   35.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.17 - * version 2 for more details (a copy is included in the LICENSE file that
   35.18 - * accompanied this code).
   35.19 - *
   35.20 - * You should have received a copy of the GNU General Public License version
   35.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   35.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.23 - *
   35.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.25 - * or visit www.oracle.com if you need additional information or have any
   35.26 - * questions.
   35.27 - */
   35.28 -
   35.29 -package java.io;
   35.30 -
   35.31 -/**
   35.32 - * Thrown when the Serialization runtime detects one of the following
   35.33 - * problems with a Class.
   35.34 - * <UL>
   35.35 - * <LI> The serial version of the class does not match that of the class
   35.36 - *      descriptor read from the stream
   35.37 - * <LI> The class contains unknown datatypes
   35.38 - * <LI> The class does not have an accessible no-arg constructor
   35.39 - * </UL>
   35.40 - *
   35.41 - * @author  unascribed
   35.42 - * @since   JDK1.1
   35.43 - */
   35.44 -public class InvalidClassException extends ObjectStreamException {
   35.45 -
   35.46 -    private static final long serialVersionUID = -4333316296251054416L;
   35.47 -
   35.48 -    /**
   35.49 -     * Name of the invalid class.
   35.50 -     *
   35.51 -     * @serial Name of the invalid class.
   35.52 -     */
   35.53 -    public String classname;
   35.54 -
   35.55 -    /**
   35.56 -     * Report an InvalidClassException for the reason specified.
   35.57 -     *
   35.58 -     * @param reason  String describing the reason for the exception.
   35.59 -     */
   35.60 -    public InvalidClassException(String reason) {
   35.61 -        super(reason);
   35.62 -    }
   35.63 -
   35.64 -    /**
   35.65 -     * Constructs an InvalidClassException object.
   35.66 -     *
   35.67 -     * @param cname   a String naming the invalid class.
   35.68 -     * @param reason  a String describing the reason for the exception.
   35.69 -     */
   35.70 -    public InvalidClassException(String cname, String reason) {
   35.71 -        super(reason);
   35.72 -        classname = cname;
   35.73 -    }
   35.74 -
   35.75 -    /**
   35.76 -     * Produce the message and include the classname, if present.
   35.77 -     */
   35.78 -    public String getMessage() {
   35.79 -        if (classname == null)
   35.80 -            return super.getMessage();
   35.81 -        else
   35.82 -            return classname + "; " + super.getMessage();
   35.83 -    }
   35.84 -}
    36.1 --- a/emul/compact/src/main/java/java/io/InvalidObjectException.java	Fri Mar 22 16:59:47 2013 +0100
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,51 +0,0 @@
    36.4 -/*
    36.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    36.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 - *
    36.8 - * This code is free software; you can redistribute it and/or modify it
    36.9 - * under the terms of the GNU General Public License version 2 only, as
   36.10 - * published by the Free Software Foundation.  Oracle designates this
   36.11 - * particular file as subject to the "Classpath" exception as provided
   36.12 - * by Oracle in the LICENSE file that accompanied this code.
   36.13 - *
   36.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   36.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.17 - * version 2 for more details (a copy is included in the LICENSE file that
   36.18 - * accompanied this code).
   36.19 - *
   36.20 - * You should have received a copy of the GNU General Public License version
   36.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   36.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.23 - *
   36.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.25 - * or visit www.oracle.com if you need additional information or have any
   36.26 - * questions.
   36.27 - */
   36.28 -
   36.29 -package java.io;
   36.30 -
   36.31 -/**
   36.32 - * Indicates that one or more deserialized objects failed validation
   36.33 - * tests.  The argument should provide the reason for the failure.
   36.34 - *
   36.35 - * @see ObjectInputValidation
   36.36 - * @since JDK1.1
   36.37 - *
   36.38 - * @author  unascribed
   36.39 - * @since   JDK1.1
   36.40 - */
   36.41 -public class InvalidObjectException extends ObjectStreamException {
   36.42 -
   36.43 -    private static final long serialVersionUID = 3233174318281839583L;
   36.44 -
   36.45 -    /**
   36.46 -     * Constructs an <code>InvalidObjectException</code>.
   36.47 -     * @param reason Detailed message explaining the reason for the failure.
   36.48 -     *
   36.49 -     * @see ObjectInputValidation
   36.50 -     */
   36.51 -    public  InvalidObjectException(String reason) {
   36.52 -        super(reason);
   36.53 -    }
   36.54 -}
    37.1 --- a/emul/compact/src/main/java/java/io/NotActiveException.java	Fri Mar 22 16:59:47 2013 +0100
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,53 +0,0 @@
    37.4 -/*
    37.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    37.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.7 - *
    37.8 - * This code is free software; you can redistribute it and/or modify it
    37.9 - * under the terms of the GNU General Public License version 2 only, as
   37.10 - * published by the Free Software Foundation.  Oracle designates this
   37.11 - * particular file as subject to the "Classpath" exception as provided
   37.12 - * by Oracle in the LICENSE file that accompanied this code.
   37.13 - *
   37.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   37.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.17 - * version 2 for more details (a copy is included in the LICENSE file that
   37.18 - * accompanied this code).
   37.19 - *
   37.20 - * You should have received a copy of the GNU General Public License version
   37.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   37.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.23 - *
   37.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.25 - * or visit www.oracle.com if you need additional information or have any
   37.26 - * questions.
   37.27 - */
   37.28 -
   37.29 -package java.io;
   37.30 -
   37.31 -/**
   37.32 - * Thrown when serialization or deserialization is not active.
   37.33 - *
   37.34 - * @author  unascribed
   37.35 - * @since   JDK1.1
   37.36 - */
   37.37 -public class NotActiveException extends ObjectStreamException {
   37.38 -
   37.39 -    private static final long serialVersionUID = -3893467273049808895L;
   37.40 -
   37.41 -    /**
   37.42 -     * Constructor to create a new NotActiveException with the reason given.
   37.43 -     *
   37.44 -     * @param reason  a String describing the reason for the exception.
   37.45 -     */
   37.46 -    public NotActiveException(String reason) {
   37.47 -        super(reason);
   37.48 -    }
   37.49 -
   37.50 -    /**
   37.51 -     * Constructor to create a new NotActiveException without a reason.
   37.52 -     */
   37.53 -    public NotActiveException() {
   37.54 -        super();
   37.55 -    }
   37.56 -}
    38.1 --- a/emul/compact/src/main/java/java/io/NotSerializableException.java	Fri Mar 22 16:59:47 2013 +0100
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,55 +0,0 @@
    38.4 -/*
    38.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
    38.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.7 - *
    38.8 - * This code is free software; you can redistribute it and/or modify it
    38.9 - * under the terms of the GNU General Public License version 2 only, as
   38.10 - * published by the Free Software Foundation.  Oracle designates this
   38.11 - * particular file as subject to the "Classpath" exception as provided
   38.12 - * by Oracle in the LICENSE file that accompanied this code.
   38.13 - *
   38.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   38.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   38.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   38.17 - * version 2 for more details (a copy is included in the LICENSE file that
   38.18 - * accompanied this code).
   38.19 - *
   38.20 - * You should have received a copy of the GNU General Public License version
   38.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   38.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   38.23 - *
   38.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   38.25 - * or visit www.oracle.com if you need additional information or have any
   38.26 - * questions.
   38.27 - */
   38.28 -
   38.29 -package java.io;
   38.30 -
   38.31 -/**
   38.32 - * Thrown when an instance is required to have a Serializable interface.
   38.33 - * The serialization runtime or the class of the instance can throw
   38.34 - * this exception. The argument should be the name of the class.
   38.35 - *
   38.36 - * @author  unascribed
   38.37 - * @since   JDK1.1
   38.38 - */
   38.39 -public class NotSerializableException extends ObjectStreamException {
   38.40 -
   38.41 -    private static final long serialVersionUID = 2906642554793891381L;
   38.42 -
   38.43 -    /**
   38.44 -     * Constructs a NotSerializableException object with message string.
   38.45 -     *
   38.46 -     * @param classname Class of the instance being serialized/deserialized.
   38.47 -     */
   38.48 -    public NotSerializableException(String classname) {
   38.49 -        super(classname);
   38.50 -    }
   38.51 -
   38.52 -    /**
   38.53 -     *  Constructs a NotSerializableException object.
   38.54 -     */
   38.55 -    public NotSerializableException() {
   38.56 -        super();
   38.57 -    }
   38.58 -}
    39.1 --- a/emul/compact/src/main/java/java/io/ObjectInput.java	Fri Mar 22 16:59:47 2013 +0100
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,107 +0,0 @@
    39.4 -/*
    39.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    39.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.7 - *
    39.8 - * This code is free software; you can redistribute it and/or modify it
    39.9 - * under the terms of the GNU General Public License version 2 only, as
   39.10 - * published by the Free Software Foundation.  Oracle designates this
   39.11 - * particular file as subject to the "Classpath" exception as provided
   39.12 - * by Oracle in the LICENSE file that accompanied this code.
   39.13 - *
   39.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   39.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   39.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   39.17 - * version 2 for more details (a copy is included in the LICENSE file that
   39.18 - * accompanied this code).
   39.19 - *
   39.20 - * You should have received a copy of the GNU General Public License version
   39.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   39.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   39.23 - *
   39.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   39.25 - * or visit www.oracle.com if you need additional information or have any
   39.26 - * questions.
   39.27 - */
   39.28 -
   39.29 -package java.io;
   39.30 -
   39.31 -/**
   39.32 - * ObjectInput extends the DataInput interface to include the reading of
   39.33 - * objects. DataInput includes methods for the input of primitive types,
   39.34 - * ObjectInput extends that interface to include objects, arrays, and Strings.
   39.35 - *
   39.36 - * @author  unascribed
   39.37 - * @see java.io.InputStream
   39.38 - * @see java.io.ObjectOutputStream
   39.39 - * @see java.io.ObjectInputStream
   39.40 - * @since   JDK1.1
   39.41 - */
   39.42 -public interface ObjectInput extends DataInput, AutoCloseable {
   39.43 -    /**
   39.44 -     * Read and return an object. The class that implements this interface
   39.45 -     * defines where the object is "read" from.
   39.46 -     *
   39.47 -     * @return the object read from the stream
   39.48 -     * @exception java.lang.ClassNotFoundException If the class of a serialized
   39.49 -     *      object cannot be found.
   39.50 -     * @exception IOException If any of the usual Input/Output
   39.51 -     * related exceptions occur.
   39.52 -     */
   39.53 -    public Object readObject()
   39.54 -        throws ClassNotFoundException, IOException;
   39.55 -
   39.56 -    /**
   39.57 -     * Reads a byte of data. This method will block if no input is
   39.58 -     * available.
   39.59 -     * @return  the byte read, or -1 if the end of the
   39.60 -     *          stream is reached.
   39.61 -     * @exception IOException If an I/O error has occurred.
   39.62 -     */
   39.63 -    public int read() throws IOException;
   39.64 -
   39.65 -    /**
   39.66 -     * Reads into an array of bytes.  This method will
   39.67 -     * block until some input is available.
   39.68 -     * @param b the buffer into which the data is read
   39.69 -     * @return  the actual number of bytes read, -1 is
   39.70 -     *          returned when the end of the stream is reached.
   39.71 -     * @exception IOException If an I/O error has occurred.
   39.72 -     */
   39.73 -    public int read(byte b[]) throws IOException;
   39.74 -
   39.75 -    /**
   39.76 -     * Reads into an array of bytes.  This method will
   39.77 -     * block until some input is available.
   39.78 -     * @param b the buffer into which the data is read
   39.79 -     * @param off the start offset of the data
   39.80 -     * @param len the maximum number of bytes read
   39.81 -     * @return  the actual number of bytes read, -1 is
   39.82 -     *          returned when the end of the stream is reached.
   39.83 -     * @exception IOException If an I/O error has occurred.
   39.84 -     */
   39.85 -    public int read(byte b[], int off, int len) throws IOException;
   39.86 -
   39.87 -    /**
   39.88 -     * Skips n bytes of input.
   39.89 -     * @param n the number of bytes to be skipped
   39.90 -     * @return  the actual number of bytes skipped.
   39.91 -     * @exception IOException If an I/O error has occurred.
   39.92 -     */
   39.93 -    public long skip(long n) throws IOException;
   39.94 -
   39.95 -    /**
   39.96 -     * Returns the number of bytes that can be read
   39.97 -     * without blocking.
   39.98 -     * @return the number of available bytes.
   39.99 -     * @exception IOException If an I/O error has occurred.
  39.100 -     */
  39.101 -    public int available() throws IOException;
  39.102 -
  39.103 -    /**
  39.104 -     * Closes the input stream. Must be called
  39.105 -     * to release any resources associated with
  39.106 -     * the stream.
  39.107 -     * @exception IOException If an I/O error has occurred.
  39.108 -     */
  39.109 -    public void close() throws IOException;
  39.110 -}
    40.1 --- a/emul/compact/src/main/java/java/io/ObjectInputStream.java	Fri Mar 22 16:59:47 2013 +0100
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,3357 +0,0 @@
    40.4 -/*
    40.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    40.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.7 - *
    40.8 - * This code is free software; you can redistribute it and/or modify it
    40.9 - * under the terms of the GNU General Public License version 2 only, as
   40.10 - * published by the Free Software Foundation.  Oracle designates this
   40.11 - * particular file as subject to the "Classpath" exception as provided
   40.12 - * by Oracle in the LICENSE file that accompanied this code.
   40.13 - *
   40.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   40.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   40.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   40.17 - * version 2 for more details (a copy is included in the LICENSE file that
   40.18 - * accompanied this code).
   40.19 - *
   40.20 - * You should have received a copy of the GNU General Public License version
   40.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   40.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   40.23 - *
   40.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   40.25 - * or visit www.oracle.com if you need additional information or have any
   40.26 - * questions.
   40.27 - */
   40.28 -
   40.29 -package java.io;
   40.30 -
   40.31 -import java.lang.reflect.Array;
   40.32 -import java.lang.reflect.Modifier;
   40.33 -import java.lang.reflect.Proxy;
   40.34 -import java.util.Arrays;
   40.35 -import java.util.HashMap;
   40.36 -import org.apidesign.bck2brwsr.emul.lang.System;
   40.37 -
   40.38 -/**
   40.39 - * An ObjectInputStream deserializes primitive data and objects previously
   40.40 - * written using an ObjectOutputStream.
   40.41 - *
   40.42 - * <p>ObjectOutputStream and ObjectInputStream can provide an application with
   40.43 - * persistent storage for graphs of objects when used with a FileOutputStream
   40.44 - * and FileInputStream respectively.  ObjectInputStream is used to recover
   40.45 - * those objects previously serialized. Other uses include passing objects
   40.46 - * between hosts using a socket stream or for marshaling and unmarshaling
   40.47 - * arguments and parameters in a remote communication system.
   40.48 - *
   40.49 - * <p>ObjectInputStream ensures that the types of all objects in the graph
   40.50 - * created from the stream match the classes present in the Java Virtual
   40.51 - * Machine.  Classes are loaded as required using the standard mechanisms.
   40.52 - *
   40.53 - * <p>Only objects that support the java.io.Serializable or
   40.54 - * java.io.Externalizable interface can be read from streams.
   40.55 - *
   40.56 - * <p>The method <code>readObject</code> is used to read an object from the
   40.57 - * stream.  Java's safe casting should be used to get the desired type.  In
   40.58 - * Java, strings and arrays are objects and are treated as objects during
   40.59 - * serialization. When read they need to be cast to the expected type.
   40.60 - *
   40.61 - * <p>Primitive data types can be read from the stream using the appropriate
   40.62 - * method on DataInput.
   40.63 - *
   40.64 - * <p>The default deserialization mechanism for objects restores the contents
   40.65 - * of each field to the value and type it had when it was written.  Fields
   40.66 - * declared as transient or static are ignored by the deserialization process.
   40.67 - * References to other objects cause those objects to be read from the stream
   40.68 - * as necessary.  Graphs of objects are restored correctly using a reference
   40.69 - * sharing mechanism.  New objects are always allocated when deserializing,
   40.70 - * which prevents existing objects from being overwritten.
   40.71 - *
   40.72 - * <p>Reading an object is analogous to running the constructors of a new
   40.73 - * object.  Memory is allocated for the object and initialized to zero (NULL).
   40.74 - * No-arg constructors are invoked for the non-serializable classes and then
   40.75 - * the fields of the serializable classes are restored from the stream starting
   40.76 - * with the serializable class closest to java.lang.object and finishing with
   40.77 - * the object's most specific class.
   40.78 - *
   40.79 - * <p>For example to read from a stream as written by the example in
   40.80 - * ObjectOutputStream:
   40.81 - * <br>
   40.82 - * <pre>
   40.83 - *      FileInputStream fis = new FileInputStream("t.tmp");
   40.84 - *      ObjectInputStream ois = new ObjectInputStream(fis);
   40.85 - *
   40.86 - *      int i = ois.readInt();
   40.87 - *      String today = (String) ois.readObject();
   40.88 - *      Date date = (Date) ois.readObject();
   40.89 - *
   40.90 - *      ois.close();
   40.91 - * </pre>
   40.92 - *
   40.93 - * <p>Classes control how they are serialized by implementing either the
   40.94 - * java.io.Serializable or java.io.Externalizable interfaces.
   40.95 - *
   40.96 - * <p>Implementing the Serializable interface allows object serialization to
   40.97 - * save and restore the entire state of the object and it allows classes to
   40.98 - * evolve between the time the stream is written and the time it is read.  It
   40.99 - * automatically traverses references between objects, saving and restoring
  40.100 - * entire graphs.
  40.101 - *
  40.102 - * <p>Serializable classes that require special handling during the
  40.103 - * serialization and deserialization process should implement the following
  40.104 - * methods:<p>
  40.105 - *
  40.106 - * <pre>
  40.107 - * private void writeObject(java.io.ObjectOutputStream stream)
  40.108 - *     throws IOException;
  40.109 - * private void readObject(java.io.ObjectInputStream stream)
  40.110 - *     throws IOException, ClassNotFoundException;
  40.111 - * private void readObjectNoData()
  40.112 - *     throws ObjectStreamException;
  40.113 - * </pre>
  40.114 - *
  40.115 - * <p>The readObject method is responsible for reading and restoring the state
  40.116 - * of the object for its particular class using data written to the stream by
  40.117 - * the corresponding writeObject method.  The method does not need to concern
  40.118 - * itself with the state belonging to its superclasses or subclasses.  State is
  40.119 - * restored by reading data from the ObjectInputStream for the individual
  40.120 - * fields and making assignments to the appropriate fields of the object.
  40.121 - * Reading primitive data types is supported by DataInput.
  40.122 - *
  40.123 - * <p>Any attempt to read object data which exceeds the boundaries of the
  40.124 - * custom data written by the corresponding writeObject method will cause an
  40.125 - * OptionalDataException to be thrown with an eof field value of true.
  40.126 - * Non-object reads which exceed the end of the allotted data will reflect the
  40.127 - * end of data in the same way that they would indicate the end of the stream:
  40.128 - * bytewise reads will return -1 as the byte read or number of bytes read, and
  40.129 - * primitive reads will throw EOFExceptions.  If there is no corresponding
  40.130 - * writeObject method, then the end of default serialized data marks the end of
  40.131 - * the allotted data.
  40.132 - *
  40.133 - * <p>Primitive and object read calls issued from within a readExternal method
  40.134 - * behave in the same manner--if the stream is already positioned at the end of
  40.135 - * data written by the corresponding writeExternal method, object reads will
  40.136 - * throw OptionalDataExceptions with eof set to true, bytewise reads will
  40.137 - * return -1, and primitive reads will throw EOFExceptions.  Note that this
  40.138 - * behavior does not hold for streams written with the old
  40.139 - * <code>ObjectStreamConstants.PROTOCOL_VERSION_1</code> protocol, in which the
  40.140 - * end of data written by writeExternal methods is not demarcated, and hence
  40.141 - * cannot be detected.
  40.142 - *
  40.143 - * <p>The readObjectNoData method is responsible for initializing the state of
  40.144 - * the object for its particular class in the event that the serialization
  40.145 - * stream does not list the given class as a superclass of the object being
  40.146 - * deserialized.  This may occur in cases where the receiving party uses a
  40.147 - * different version of the deserialized instance's class than the sending
  40.148 - * party, and the receiver's version extends classes that are not extended by
  40.149 - * the sender's version.  This may also occur if the serialization stream has
  40.150 - * been tampered; hence, readObjectNoData is useful for initializing
  40.151 - * deserialized objects properly despite a "hostile" or incomplete source
  40.152 - * stream.
  40.153 - *
  40.154 - * <p>Serialization does not read or assign values to the fields of any object
  40.155 - * that does not implement the java.io.Serializable interface.  Subclasses of
  40.156 - * Objects that are not serializable can be serializable. In this case the
  40.157 - * non-serializable class must have a no-arg constructor to allow its fields to
  40.158 - * be initialized.  In this case it is the responsibility of the subclass to
  40.159 - * save and restore the state of the non-serializable class. It is frequently
  40.160 - * the case that the fields of that class are accessible (public, package, or
  40.161 - * protected) or that there are get and set methods that can be used to restore
  40.162 - * the state.
  40.163 - *
  40.164 - * <p>Any exception that occurs while deserializing an object will be caught by
  40.165 - * the ObjectInputStream and abort the reading process.
  40.166 - *
  40.167 - * <p>Implementing the Externalizable interface allows the object to assume
  40.168 - * complete control over the contents and format of the object's serialized
  40.169 - * form.  The methods of the Externalizable interface, writeExternal and
  40.170 - * readExternal, are called to save and restore the objects state.  When
  40.171 - * implemented by a class they can write and read their own state using all of
  40.172 - * the methods of ObjectOutput and ObjectInput.  It is the responsibility of
  40.173 - * the objects to handle any versioning that occurs.
  40.174 - *
  40.175 - * <p>Enum constants are deserialized differently than ordinary serializable or
  40.176 - * externalizable objects.  The serialized form of an enum constant consists
  40.177 - * solely of its name; field values of the constant are not transmitted.  To
  40.178 - * deserialize an enum constant, ObjectInputStream reads the constant name from
  40.179 - * the stream; the deserialized constant is then obtained by calling the static
  40.180 - * method <code>Enum.valueOf(Class, String)</code> with the enum constant's
  40.181 - * base type and the received constant name as arguments.  Like other
  40.182 - * serializable or externalizable objects, enum constants can function as the
  40.183 - * targets of back references appearing subsequently in the serialization
  40.184 - * stream.  The process by which enum constants are deserialized cannot be
  40.185 - * customized: any class-specific readObject, readObjectNoData, and readResolve
  40.186 - * methods defined by enum types are ignored during deserialization.
  40.187 - * Similarly, any serialPersistentFields or serialVersionUID field declarations
  40.188 - * are also ignored--all enum types have a fixed serialVersionUID of 0L.
  40.189 - *
  40.190 - * @author      Mike Warres
  40.191 - * @author      Roger Riggs
  40.192 - * @see java.io.DataInput
  40.193 - * @see java.io.ObjectOutputStream
  40.194 - * @see java.io.Serializable
  40.195 - * @see <a href="../../../platform/serialization/spec/input.html"> Object Serialization Specification, Section 3, Object Input Classes</a>
  40.196 - * @since   JDK1.1
  40.197 - */
  40.198 -public class ObjectInputStream
  40.199 -    extends InputStream implements ObjectInput, ObjectStreamConstants
  40.200 -{
  40.201 -    /** handle value representing null */
  40.202 -    private static final int NULL_HANDLE = -1;
  40.203 -
  40.204 -    /** marker for unshared objects in internal handle table */
  40.205 -    private static final Object unsharedMarker = new Object();
  40.206 -
  40.207 -    /** table mapping primitive type names to corresponding class objects */
  40.208 -    private static final HashMap<String, Class<?>> primClasses
  40.209 -        = new HashMap<>(8, 1.0F);
  40.210 -    static {
  40.211 -        primClasses.put("boolean", boolean.class);
  40.212 -        primClasses.put("byte", byte.class);
  40.213 -        primClasses.put("char", char.class);
  40.214 -        primClasses.put("short", short.class);
  40.215 -        primClasses.put("int", int.class);
  40.216 -        primClasses.put("long", long.class);
  40.217 -        primClasses.put("float", float.class);
  40.218 -        primClasses.put("double", double.class);
  40.219 -        primClasses.put("void", void.class);
  40.220 -    }
  40.221 -
  40.222 -    /** filter stream for handling block data conversion */
  40.223 -    private final BlockDataInputStream bin;
  40.224 -    /** validation callback list */
  40.225 -    private final ValidationList vlist;
  40.226 -    /** recursion depth */
  40.227 -    private int depth;
  40.228 -    /** whether stream is closed */
  40.229 -    private boolean closed;
  40.230 -
  40.231 -    /** wire handle -> obj/exception map */
  40.232 -    private final HandleTable handles;
  40.233 -    /** scratch field for passing handle values up/down call stack */
  40.234 -    private int passHandle = NULL_HANDLE;
  40.235 -    /** flag set when at end of field value block with no TC_ENDBLOCKDATA */
  40.236 -    private boolean defaultDataEnd = false;
  40.237 -
  40.238 -    /** buffer for reading primitive field values */
  40.239 -    private byte[] primVals;
  40.240 -
  40.241 -    /** if true, invoke readObjectOverride() instead of readObject() */
  40.242 -    private final boolean enableOverride;
  40.243 -    /** if true, invoke resolveObject() */
  40.244 -    private boolean enableResolve;
  40.245 -
  40.246 -    /**
  40.247 -     * Context during upcalls to class-defined readObject methods; holds
  40.248 -     * object currently being deserialized and descriptor for current class.
  40.249 -     * Null when not during readObject upcall.
  40.250 -     */
  40.251 -    private Object curContext;
  40.252 -
  40.253 -    /**
  40.254 -     * Creates an ObjectInputStream that reads from the specified InputStream.
  40.255 -     * A serialization stream header is read from the stream and verified.
  40.256 -     * This constructor will block until the corresponding ObjectOutputStream
  40.257 -     * has written and flushed the header.
  40.258 -     *
  40.259 -     * <p>If a security manager is installed, this constructor will check for
  40.260 -     * the "enableSubclassImplementation" SerializablePermission when invoked
  40.261 -     * directly or indirectly by the constructor of a subclass which overrides
  40.262 -     * the ObjectInputStream.readFields or ObjectInputStream.readUnshared
  40.263 -     * methods.
  40.264 -     *
  40.265 -     * @param   in input stream to read from
  40.266 -     * @throws  StreamCorruptedException if the stream header is incorrect
  40.267 -     * @throws  IOException if an I/O error occurs while reading stream header
  40.268 -     * @throws  SecurityException if untrusted subclass illegally overrides
  40.269 -     *          security-sensitive methods
  40.270 -     * @throws  NullPointerException if <code>in</code> is <code>null</code>
  40.271 -     * @see     ObjectInputStream#ObjectInputStream()
  40.272 -     * @see     ObjectInputStream#readFields()
  40.273 -     * @see     ObjectOutputStream#ObjectOutputStream(OutputStream)
  40.274 -     */
  40.275 -    public ObjectInputStream(InputStream in) throws IOException {
  40.276 -        verifySubclass();
  40.277 -        bin = new BlockDataInputStream(in);
  40.278 -        handles = new HandleTable(10);
  40.279 -        vlist = new ValidationList();
  40.280 -        enableOverride = false;
  40.281 -        readStreamHeader();
  40.282 -        bin.setBlockDataMode(true);
  40.283 -    }
  40.284 -
  40.285 -    /**
  40.286 -     * Provide a way for subclasses that are completely reimplementing
  40.287 -     * ObjectInputStream to not have to allocate private data just used by this
  40.288 -     * implementation of ObjectInputStream.
  40.289 -     *
  40.290 -     * <p>If there is a security manager installed, this method first calls the
  40.291 -     * security manager's <code>checkPermission</code> method with the
  40.292 -     * <code>SerializablePermission("enableSubclassImplementation")</code>
  40.293 -     * permission to ensure it's ok to enable subclassing.
  40.294 -     *
  40.295 -     * @throws  SecurityException if a security manager exists and its
  40.296 -     *          <code>checkPermission</code> method denies enabling
  40.297 -     *          subclassing.
  40.298 -     * @see SecurityManager#checkPermission
  40.299 -     * @see java.io.SerializablePermission
  40.300 -     */
  40.301 -    protected ObjectInputStream() throws IOException, SecurityException {
  40.302 -        throw new SecurityException();
  40.303 -    }
  40.304 -
  40.305 -    /**
  40.306 -     * Read an object from the ObjectInputStream.  The class of the object, the
  40.307 -     * signature of the class, and the values of the non-transient and
  40.308 -     * non-static fields of the class and all of its supertypes are read.
  40.309 -     * Default deserializing for a class can be overriden using the writeObject
  40.310 -     * and readObject methods.  Objects referenced by this object are read
  40.311 -     * transitively so that a complete equivalent graph of objects is
  40.312 -     * reconstructed by readObject.
  40.313 -     *
  40.314 -     * <p>The root object is completely restored when all of its fields and the
  40.315 -     * objects it references are completely restored.  At this point the object
  40.316 -     * validation callbacks are executed in order based on their registered
  40.317 -     * priorities. The callbacks are registered by objects (in the readObject
  40.318 -     * special methods) as they are individually restored.
  40.319 -     *
  40.320 -     * <p>Exceptions are thrown for problems with the InputStream and for
  40.321 -     * classes that should not be deserialized.  All exceptions are fatal to
  40.322 -     * the InputStream and leave it in an indeterminate state; it is up to the
  40.323 -     * caller to ignore or recover the stream state.
  40.324 -     *
  40.325 -     * @throws  ClassNotFoundException Class of a serialized object cannot be
  40.326 -     *          found.
  40.327 -     * @throws  InvalidClassException Something is wrong with a class used by
  40.328 -     *          serialization.
  40.329 -     * @throws  StreamCorruptedException Control information in the
  40.330 -     *          stream is inconsistent.
  40.331 -     * @throws  OptionalDataException Primitive data was found in the
  40.332 -     *          stream instead of objects.
  40.333 -     * @throws  IOException Any of the usual Input/Output related exceptions.
  40.334 -     */
  40.335 -    public final Object readObject()
  40.336 -        throws IOException, ClassNotFoundException
  40.337 -    {
  40.338 -        throw new IOException();
  40.339 -    }
  40.340 -
  40.341 -    /**
  40.342 -     * This method is called by trusted subclasses of ObjectOutputStream that
  40.343 -     * constructed ObjectOutputStream using the protected no-arg constructor.
  40.344 -     * The subclass is expected to provide an override method with the modifier
  40.345 -     * "final".
  40.346 -     *
  40.347 -     * @return  the Object read from the stream.
  40.348 -     * @throws  ClassNotFoundException Class definition of a serialized object
  40.349 -     *          cannot be found.
  40.350 -     * @throws  OptionalDataException Primitive data was found in the stream
  40.351 -     *          instead of objects.
  40.352 -     * @throws  IOException if I/O errors occurred while reading from the
  40.353 -     *          underlying stream
  40.354 -     * @see #ObjectInputStream()
  40.355 -     * @see #readObject()
  40.356 -     * @since 1.2
  40.357 -     */
  40.358 -    protected Object readObjectOverride()
  40.359 -        throws IOException, ClassNotFoundException
  40.360 -    {
  40.361 -        return null;
  40.362 -    }
  40.363 -
  40.364 -    /**
  40.365 -     * Reads an "unshared" object from the ObjectInputStream.  This method is
  40.366 -     * identical to readObject, except that it prevents subsequent calls to
  40.367 -     * readObject and readUnshared from returning additional references to the
  40.368 -     * deserialized instance obtained via this call.  Specifically:
  40.369 -     * <ul>
  40.370 -     *   <li>If readUnshared is called to deserialize a back-reference (the
  40.371 -     *       stream representation of an object which has been written
  40.372 -     *       previously to the stream), an ObjectStreamException will be
  40.373 -     *       thrown.
  40.374 -     *
  40.375 -     *   <li>If readUnshared returns successfully, then any subsequent attempts
  40.376 -     *       to deserialize back-references to the stream handle deserialized
  40.377 -     *       by readUnshared will cause an ObjectStreamException to be thrown.
  40.378 -     * </ul>
  40.379 -     * Deserializing an object via readUnshared invalidates the stream handle
  40.380 -     * associated with the returned object.  Note that this in itself does not
  40.381 -     * always guarantee that the reference returned by readUnshared is unique;
  40.382 -     * the deserialized object may define a readResolve method which returns an
  40.383 -     * object visible to other parties, or readUnshared may return a Class
  40.384 -     * object or enum constant obtainable elsewhere in the stream or through
  40.385 -     * external means. If the deserialized object defines a readResolve method
  40.386 -     * and the invocation of that method returns an array, then readUnshared
  40.387 -     * returns a shallow clone of that array; this guarantees that the returned
  40.388 -     * array object is unique and cannot be obtained a second time from an
  40.389 -     * invocation of readObject or readUnshared on the ObjectInputStream,
  40.390 -     * even if the underlying data stream has been manipulated.
  40.391 -     *
  40.392 -     * <p>ObjectInputStream subclasses which override this method can only be
  40.393 -     * constructed in security contexts possessing the
  40.394 -     * "enableSubclassImplementation" SerializablePermission; any attempt to
  40.395 -     * instantiate such a subclass without this permission will cause a
  40.396 -     * SecurityException to be thrown.
  40.397 -     *
  40.398 -     * @return  reference to deserialized object
  40.399 -     * @throws  ClassNotFoundException if class of an object to deserialize
  40.400 -     *          cannot be found
  40.401 -     * @throws  StreamCorruptedException if control information in the stream
  40.402 -     *          is inconsistent
  40.403 -     * @throws  ObjectStreamException if object to deserialize has already
  40.404 -     *          appeared in stream
  40.405 -     * @throws  OptionalDataException if primitive data is next in stream
  40.406 -     * @throws  IOException if an I/O error occurs during deserialization
  40.407 -     * @since   1.4
  40.408 -     */
  40.409 -    public Object readUnshared() throws IOException, ClassNotFoundException {
  40.410 -        // if nested read, passHandle contains handle of enclosing object
  40.411 -        int outerHandle = passHandle;
  40.412 -        try {
  40.413 -            Object obj = readObject0(true);
  40.414 -            handles.markDependency(outerHandle, passHandle);
  40.415 -            ClassNotFoundException ex = handles.lookupException(passHandle);
  40.416 -            if (ex != null) {
  40.417 -                throw ex;
  40.418 -            }
  40.419 -            if (depth == 0) {
  40.420 -                vlist.doCallbacks();
  40.421 -            }
  40.422 -            return obj;
  40.423 -        } finally {
  40.424 -            passHandle = outerHandle;
  40.425 -            if (closed && depth == 0) {
  40.426 -                clear();
  40.427 -            }
  40.428 -        }
  40.429 -    }
  40.430 -
  40.431 -    /**
  40.432 -     * Read the non-static and non-transient fields of the current class from
  40.433 -     * this stream.  This may only be called from the readObject method of the
  40.434 -     * class being deserialized. It will throw the NotActiveException if it is
  40.435 -     * called otherwise.
  40.436 -     *
  40.437 -     * @throws  ClassNotFoundException if the class of a serialized object
  40.438 -     *          could not be found.
  40.439 -     * @throws  IOException if an I/O error occurs.
  40.440 -     * @throws  NotActiveException if the stream is not currently reading
  40.441 -     *          objects.
  40.442 -     */
  40.443 -    public void defaultReadObject()
  40.444 -        throws IOException, ClassNotFoundException
  40.445 -    {
  40.446 -        if (curContext == null) {
  40.447 -            throw new NotActiveException("not in call to readObject");
  40.448 -        }
  40.449 -        Object curObj = null; // curContext.getObj();
  40.450 -        ObjectStreamClass curDesc = null; // curContext.getDesc();
  40.451 -        bin.setBlockDataMode(false);
  40.452 -        defaultReadFields(curObj, curDesc);
  40.453 -        bin.setBlockDataMode(true);
  40.454 -        if (!curDesc.hasWriteObjectData()) {
  40.455 -            /*
  40.456 -             * Fix for 4360508: since stream does not contain terminating
  40.457 -             * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere
  40.458 -             * knows to simulate end-of-custom-data behavior.
  40.459 -             */
  40.460 -            defaultDataEnd = true;
  40.461 -        }
  40.462 -        ClassNotFoundException ex = handles.lookupException(passHandle);
  40.463 -        if (ex != null) {
  40.464 -            throw ex;
  40.465 -        }
  40.466 -    }
  40.467 -
  40.468 -    /**
  40.469 -     * Reads the persistent fields from the stream and makes them available by
  40.470 -     * name.
  40.471 -     *
  40.472 -     * @return  the <code>GetField</code> object representing the persistent
  40.473 -     *          fields of the object being deserialized
  40.474 -     * @throws  ClassNotFoundException if the class of a serialized object
  40.475 -     *          could not be found.
  40.476 -     * @throws  IOException if an I/O error occurs.
  40.477 -     * @throws  NotActiveException if the stream is not currently reading
  40.478 -     *          objects.
  40.479 -     * @since 1.2
  40.480 -     */
  40.481 -    public ObjectInputStream.GetField readFields()
  40.482 -        throws IOException, ClassNotFoundException
  40.483 -    {
  40.484 -        if (curContext == null) {
  40.485 -            throw new NotActiveException("not in call to readObject");
  40.486 -        }
  40.487 -        Object curObj = null; // curContext.getObj();
  40.488 -        ObjectStreamClass curDesc = null; // curContext.getDesc();
  40.489 -        bin.setBlockDataMode(false);
  40.490 -        GetFieldImpl getField = new GetFieldImpl(curDesc);
  40.491 -        getField.readFields();
  40.492 -        bin.setBlockDataMode(true);
  40.493 -        if (!curDesc.hasWriteObjectData()) {
  40.494 -            /*
  40.495 -             * Fix for 4360508: since stream does not contain terminating
  40.496 -             * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere
  40.497 -             * knows to simulate end-of-custom-data behavior.
  40.498 -             */
  40.499 -            defaultDataEnd = true;
  40.500 -        }
  40.501 -
  40.502 -        return getField;
  40.503 -    }
  40.504 -
  40.505 -    /**
  40.506 -     * Register an object to be validated before the graph is returned.  While
  40.507 -     * similar to resolveObject these validations are called after the entire
  40.508 -     * graph has been reconstituted.  Typically, a readObject method will
  40.509 -     * register the object with the stream so that when all of the objects are
  40.510 -     * restored a final set of validations can be performed.
  40.511 -     *
  40.512 -     * @param   obj the object to receive the validation callback.
  40.513 -     * @param   prio controls the order of callbacks;zero is a good default.
  40.514 -     *          Use higher numbers to be called back earlier, lower numbers for
  40.515 -     *          later callbacks. Within a priority, callbacks are processed in
  40.516 -     *          no particular order.
  40.517 -     * @throws  NotActiveException The stream is not currently reading objects
  40.518 -     *          so it is invalid to register a callback.
  40.519 -     * @throws  InvalidObjectException The validation object is null.
  40.520 -     */
  40.521 -    public void registerValidation(ObjectInputValidation obj, int prio)
  40.522 -        throws NotActiveException, InvalidObjectException
  40.523 -    {
  40.524 -        if (depth == 0) {
  40.525 -            throw new NotActiveException("stream inactive");
  40.526 -        }
  40.527 -        vlist.register(obj, prio);
  40.528 -    }
  40.529 -
  40.530 -    /**
  40.531 -     * Load the local class equivalent of the specified stream class
  40.532 -     * description.  Subclasses may implement this method to allow classes to
  40.533 -     * be fetched from an alternate source.
  40.534 -     *
  40.535 -     * <p>The corresponding method in <code>ObjectOutputStream</code> is
  40.536 -     * <code>annotateClass</code>.  This method will be invoked only once for
  40.537 -     * each unique class in the stream.  This method can be implemented by
  40.538 -     * subclasses to use an alternate loading mechanism but must return a
  40.539 -     * <code>Class</code> object. Once returned, if the class is not an array
  40.540 -     * class, its serialVersionUID is compared to the serialVersionUID of the
  40.541 -     * serialized class, and if there is a mismatch, the deserialization fails
  40.542 -     * and an {@link InvalidClassException} is thrown.
  40.543 -     *
  40.544 -     * <p>The default implementation of this method in
  40.545 -     * <code>ObjectInputStream</code> returns the result of calling
  40.546 -     * <pre>
  40.547 -     *     Class.forName(desc.getName(), false, loader)
  40.548 -     * </pre>
  40.549 -     * where <code>loader</code> is determined as follows: if there is a
  40.550 -     * method on the current thread's stack whose declaring class was
  40.551 -     * defined by a user-defined class loader (and was not a generated to
  40.552 -     * implement reflective invocations), then <code>loader</code> is class
  40.553 -     * loader corresponding to the closest such method to the currently
  40.554 -     * executing frame; otherwise, <code>loader</code> is
  40.555 -     * <code>null</code>. If this call results in a
  40.556 -     * <code>ClassNotFoundException</code> and the name of the passed
  40.557 -     * <code>ObjectStreamClass</code> instance is the Java language keyword
  40.558 -     * for a primitive type or void, then the <code>Class</code> object
  40.559 -     * representing that primitive type or void will be returned
  40.560 -     * (e.g., an <code>ObjectStreamClass</code> with the name
  40.561 -     * <code>"int"</code> will be resolved to <code>Integer.TYPE</code>).
  40.562 -     * Otherwise, the <code>ClassNotFoundException</code> will be thrown to
  40.563 -     * the caller of this method.
  40.564 -     *
  40.565 -     * @param   desc an instance of class <code>ObjectStreamClass</code>
  40.566 -     * @return  a <code>Class</code> object corresponding to <code>desc</code>
  40.567 -     * @throws  IOException any of the usual Input/Output exceptions.
  40.568 -     * @throws  ClassNotFoundException if class of a serialized object cannot
  40.569 -     *          be found.
  40.570 -     */
  40.571 -    protected Class<?> resolveClass(ObjectStreamClass desc)
  40.572 -        throws IOException, ClassNotFoundException
  40.573 -    {
  40.574 -        String name = desc.getName();
  40.575 -        try {
  40.576 -            return Class.forName(name, false, latestUserDefinedLoader());
  40.577 -        } catch (ClassNotFoundException ex) {
  40.578 -            Class<?> cl = primClasses.get(name);
  40.579 -            if (cl != null) {
  40.580 -                return cl;
  40.581 -            } else {
  40.582 -                throw ex;
  40.583 -            }
  40.584 -        }
  40.585 -    }
  40.586 -
  40.587 -    /**
  40.588 -     * Returns a proxy class that implements the interfaces named in a proxy
  40.589 -     * class descriptor; subclasses may implement this method to read custom
  40.590 -     * data from the stream along with the descriptors for dynamic proxy
  40.591 -     * classes, allowing them to use an alternate loading mechanism for the
  40.592 -     * interfaces and the proxy class.
  40.593 -     *
  40.594 -     * <p>This method is called exactly once for each unique proxy class
  40.595 -     * descriptor in the stream.
  40.596 -     *
  40.597 -     * <p>The corresponding method in <code>ObjectOutputStream</code> is
  40.598 -     * <code>annotateProxyClass</code>.  For a given subclass of
  40.599 -     * <code>ObjectInputStream</code> that overrides this method, the
  40.600 -     * <code>annotateProxyClass</code> method in the corresponding subclass of
  40.601 -     * <code>ObjectOutputStream</code> must write any data or objects read by
  40.602 -     * this method.
  40.603 -     *
  40.604 -     * <p>The default implementation of this method in
  40.605 -     * <code>ObjectInputStream</code> returns the result of calling
  40.606 -     * <code>Proxy.getProxyClass</code> with the list of <code>Class</code>
  40.607 -     * objects for the interfaces that are named in the <code>interfaces</code>
  40.608 -     * parameter.  The <code>Class</code> object for each interface name
  40.609 -     * <code>i</code> is the value returned by calling
  40.610 -     * <pre>
  40.611 -     *     Class.forName(i, false, loader)
  40.612 -     * </pre>
  40.613 -     * where <code>loader</code> is that of the first non-<code>null</code>
  40.614 -     * class loader up the execution stack, or <code>null</code> if no
  40.615 -     * non-<code>null</code> class loaders are on the stack (the same class
  40.616 -     * loader choice used by the <code>resolveClass</code> method).  Unless any
  40.617 -     * of the resolved interfaces are non-public, this same value of
  40.618 -     * <code>loader</code> is also the class loader passed to
  40.619 -     * <code>Proxy.getProxyClass</code>; if non-public interfaces are present,
  40.620 -     * their class loader is passed instead (if more than one non-public
  40.621 -     * interface class loader is encountered, an
  40.622 -     * <code>IllegalAccessError</code> is thrown).
  40.623 -     * If <code>Proxy.getProxyClass</code> throws an
  40.624 -     * <code>IllegalArgumentException</code>, <code>resolveProxyClass</code>
  40.625 -     * will throw a <code>ClassNotFoundException</code> containing the
  40.626 -     * <code>IllegalArgumentException</code>.
  40.627 -     *
  40.628 -     * @param interfaces the list of interface names that were
  40.629 -     *                deserialized in the proxy class descriptor
  40.630 -     * @return  a proxy class for the specified interfaces
  40.631 -     * @throws        IOException any exception thrown by the underlying
  40.632 -     *                <code>InputStream</code>
  40.633 -     * @throws        ClassNotFoundException if the proxy class or any of the
  40.634 -     *                named interfaces could not be found
  40.635 -     * @see ObjectOutputStream#annotateProxyClass(Class)
  40.636 -     * @since 1.3
  40.637 -     */
  40.638 -    protected Class<?> resolveProxyClass(String[] interfaces)
  40.639 -        throws IOException, ClassNotFoundException
  40.640 -    {
  40.641 -        ClassLoader latestLoader = latestUserDefinedLoader();
  40.642 -        ClassLoader nonPublicLoader = null;
  40.643 -        boolean hasNonPublicInterface = false;
  40.644 -
  40.645 -        // define proxy in class loader of non-public interface(s), if any
  40.646 -        Class[] classObjs = new Class[interfaces.length];
  40.647 -        for (int i = 0; i < interfaces.length; i++) {
  40.648 -            Class cl = Class.forName(interfaces[i], false, latestLoader);
  40.649 -            if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
  40.650 -                if (hasNonPublicInterface) {
  40.651 -                    if (nonPublicLoader != cl.getClassLoader()) {
  40.652 -                        throw new IllegalAccessError(
  40.653 -                            "conflicting non-public interface class loaders");
  40.654 -                    }
  40.655 -                } else {
  40.656 -                    nonPublicLoader = cl.getClassLoader();
  40.657 -                    hasNonPublicInterface = true;
  40.658 -                }
  40.659 -            }
  40.660 -            classObjs[i] = cl;
  40.661 -        }
  40.662 -        try {
  40.663 -            return Proxy.getProxyClass(
  40.664 -                hasNonPublicInterface ? nonPublicLoader : latestLoader,
  40.665 -                classObjs);
  40.666 -        } catch (IllegalArgumentException e) {
  40.667 -            throw new ClassNotFoundException(null, e);
  40.668 -        }
  40.669 -    }
  40.670 -
  40.671 -    /**
  40.672 -     * This method will allow trusted subclasses of ObjectInputStream to
  40.673 -     * substitute one object for another during deserialization. Replacing
  40.674 -     * objects is disabled until enableResolveObject is called. The
  40.675 -     * enableResolveObject method checks that the stream requesting to resolve
  40.676 -     * object can be trusted. Every reference to serializable objects is passed
  40.677 -     * to resolveObject.  To insure that the private state of objects is not
  40.678 -     * unintentionally exposed only trusted streams may use resolveObject.
  40.679 -     *
  40.680 -     * <p>This method is called after an object has been read but before it is
  40.681 -     * returned from readObject.  The default resolveObject method just returns
  40.682 -     * the same object.
  40.683 -     *
  40.684 -     * <p>When a subclass is replacing objects it must insure that the
  40.685 -     * substituted object is compatible with every field where the reference
  40.686 -     * will be stored.  Objects whose type is not a subclass of the type of the
  40.687 -     * field or array element abort the serialization by raising an exception
  40.688 -     * and the object is not be stored.
  40.689 -     *
  40.690 -     * <p>This method is called only once when each object is first
  40.691 -     * encountered.  All subsequent references to the object will be redirected
  40.692 -     * to the new object.
  40.693 -     *
  40.694 -     * @param   obj object to be substituted
  40.695 -     * @return  the substituted object
  40.696 -     * @throws  IOException Any of the usual Input/Output exceptions.
  40.697 -     */
  40.698 -    protected Object resolveObject(Object obj) throws IOException {
  40.699 -        return obj;
  40.700 -    }
  40.701 -
  40.702 -    /**
  40.703 -     * Enable the stream to allow objects read from the stream to be replaced.
  40.704 -     * When enabled, the resolveObject method is called for every object being
  40.705 -     * deserialized.
  40.706 -     *
  40.707 -     * <p>If <i>enable</i> is true, and there is a security manager installed,
  40.708 -     * this method first calls the security manager's
  40.709 -     * <code>checkPermission</code> method with the
  40.710 -     * <code>SerializablePermission("enableSubstitution")</code> permission to
  40.711 -     * ensure it's ok to enable the stream to allow objects read from the
  40.712 -     * stream to be replaced.
  40.713 -     *
  40.714 -     * @param   enable true for enabling use of <code>resolveObject</code> for
  40.715 -     *          every object being deserialized
  40.716 -     * @return  the previous setting before this method was invoked
  40.717 -     * @throws  SecurityException if a security manager exists and its
  40.718 -     *          <code>checkPermission</code> method denies enabling the stream
  40.719 -     *          to allow objects read from the stream to be replaced.
  40.720 -     * @see SecurityManager#checkPermission
  40.721 -     * @see java.io.SerializablePermission
  40.722 -     */
  40.723 -    protected boolean enableResolveObject(boolean enable)
  40.724 -        throws SecurityException
  40.725 -    {
  40.726 -        throw new SecurityException();
  40.727 -    }
  40.728 -
  40.729 -    /**
  40.730 -     * The readStreamHeader method is provided to allow subclasses to read and
  40.731 -     * verify their own stream headers. It reads and verifies the magic number
  40.732 -     * and version number.
  40.733 -     *
  40.734 -     * @throws  IOException if there are I/O errors while reading from the
  40.735 -     *          underlying <code>InputStream</code>
  40.736 -     * @throws  StreamCorruptedException if control information in the stream
  40.737 -     *          is inconsistent
  40.738 -     */
  40.739 -    protected void readStreamHeader()
  40.740 -        throws IOException, StreamCorruptedException
  40.741 -    {
  40.742 -        short s0 = bin.readShort();
  40.743 -        short s1 = bin.readShort();
  40.744 -        if (s0 != STREAM_MAGIC || s1 != STREAM_VERSION) {
  40.745 -            throw new StreamCorruptedException(
  40.746 -                String.format("invalid stream header: %04X%04X", s0, s1));
  40.747 -        }
  40.748 -    }
  40.749 -
  40.750 -    /**
  40.751 -     * Read a class descriptor from the serialization stream.  This method is
  40.752 -     * called when the ObjectInputStream expects a class descriptor as the next
  40.753 -     * item in the serialization stream.  Subclasses of ObjectInputStream may
  40.754 -     * override this method to read in class descriptors that have been written
  40.755 -     * in non-standard formats (by subclasses of ObjectOutputStream which have
  40.756 -     * overridden the <code>writeClassDescriptor</code> method).  By default,
  40.757 -     * this method reads class descriptors according to the format defined in
  40.758 -     * the Object Serialization specification.
  40.759 -     *
  40.760 -     * @return  the class descriptor read
  40.761 -     * @throws  IOException If an I/O error has occurred.
  40.762 -     * @throws  ClassNotFoundException If the Class of a serialized object used
  40.763 -     *          in the class descriptor representation cannot be found
  40.764 -     * @see java.io.ObjectOutputStream#writeClassDescriptor(java.io.ObjectStreamClass)
  40.765 -     * @since 1.3
  40.766 -     */
  40.767 -    protected ObjectStreamClass readClassDescriptor()
  40.768 -        throws IOException, ClassNotFoundException
  40.769 -    {
  40.770 -        ObjectStreamClass desc = new ObjectStreamClass();
  40.771 -        desc.readNonProxy(this);
  40.772 -        return desc;
  40.773 -    }
  40.774 -
  40.775 -    /**
  40.776 -     * Reads a byte of data. This method will block if no input is available.
  40.777 -     *
  40.778 -     * @return  the byte read, or -1 if the end of the stream is reached.
  40.779 -     * @throws  IOException If an I/O error has occurred.
  40.780 -     */
  40.781 -    public int read() throws IOException {
  40.782 -        return bin.read();
  40.783 -    }
  40.784 -
  40.785 -    /**
  40.786 -     * Reads into an array of bytes.  This method will block until some input
  40.787 -     * is available. Consider using java.io.DataInputStream.readFully to read
  40.788 -     * exactly 'length' bytes.
  40.789 -     *
  40.790 -     * @param   buf the buffer into which the data is read
  40.791 -     * @param   off the start offset of the data
  40.792 -     * @param   len the maximum number of bytes read
  40.793 -     * @return  the actual number of bytes read, -1 is returned when the end of
  40.794 -     *          the stream is reached.
  40.795 -     * @throws  IOException If an I/O error has occurred.
  40.796 -     * @see java.io.DataInputStream#readFully(byte[],int,int)
  40.797 -     */
  40.798 -    public int read(byte[] buf, int off, int len) throws IOException {
  40.799 -        if (buf == null) {
  40.800 -            throw new NullPointerException();
  40.801 -        }
  40.802 -        int endoff = off + len;
  40.803 -        if (off < 0 || len < 0 || endoff > buf.length || endoff < 0) {
  40.804 -            throw new IndexOutOfBoundsException();
  40.805 -        }
  40.806 -        return bin.read(buf, off, len, false);
  40.807 -    }
  40.808 -
  40.809 -    /**
  40.810 -     * Returns the number of bytes that can be read without blocking.
  40.811 -     *
  40.812 -     * @return  the number of available bytes.
  40.813 -     * @throws  IOException if there are I/O errors while reading from the
  40.814 -     *          underlying <code>InputStream</code>
  40.815 -     */
  40.816 -    public int available() throws IOException {
  40.817 -        return bin.available();
  40.818 -    }
  40.819 -
  40.820 -    /**
  40.821 -     * Closes the input stream. Must be called to release any resources
  40.822 -     * associated with the stream.
  40.823 -     *
  40.824 -     * @throws  IOException If an I/O error has occurred.
  40.825 -     */
  40.826 -    public void close() throws IOException {
  40.827 -        /*
  40.828 -         * Even if stream already closed, propagate redundant close to
  40.829 -         * underlying stream to stay consistent with previous implementations.
  40.830 -         */
  40.831 -        closed = true;
  40.832 -        if (depth == 0) {
  40.833 -            clear();
  40.834 -        }
  40.835 -        bin.close();
  40.836 -    }
  40.837 -
  40.838 -    /**
  40.839 -     * Reads in a boolean.
  40.840 -     *
  40.841 -     * @return  the boolean read.
  40.842 -     * @throws  EOFException If end of file is reached.
  40.843 -     * @throws  IOException If other I/O error has occurred.
  40.844 -     */
  40.845 -    public boolean readBoolean() throws IOException {
  40.846 -        return bin.readBoolean();
  40.847 -    }
  40.848 -
  40.849 -    /**
  40.850 -     * Reads an 8 bit byte.
  40.851 -     *
  40.852 -     * @return  the 8 bit byte read.
  40.853 -     * @throws  EOFException If end of file is reached.
  40.854 -     * @throws  IOException If other I/O error has occurred.
  40.855 -     */
  40.856 -    public byte readByte() throws IOException  {
  40.857 -        return bin.readByte();
  40.858 -    }
  40.859 -
  40.860 -    /**
  40.861 -     * Reads an unsigned 8 bit byte.
  40.862 -     *
  40.863 -     * @return  the 8 bit byte read.
  40.864 -     * @throws  EOFException If end of file is reached.
  40.865 -     * @throws  IOException If other I/O error has occurred.
  40.866 -     */
  40.867 -    public int readUnsignedByte()  throws IOException {
  40.868 -        return bin.readUnsignedByte();
  40.869 -    }
  40.870 -
  40.871 -    /**
  40.872 -     * Reads a 16 bit char.
  40.873 -     *
  40.874 -     * @return  the 16 bit char read.
  40.875 -     * @throws  EOFException If end of file is reached.
  40.876 -     * @throws  IOException If other I/O error has occurred.
  40.877 -     */
  40.878 -    public char readChar()  throws IOException {
  40.879 -        return bin.readChar();
  40.880 -    }
  40.881 -
  40.882 -    /**
  40.883 -     * Reads a 16 bit short.
  40.884 -     *
  40.885 -     * @return  the 16 bit short read.
  40.886 -     * @throws  EOFException If end of file is reached.
  40.887 -     * @throws  IOException If other I/O error has occurred.
  40.888 -     */
  40.889 -    public short readShort()  throws IOException {
  40.890 -        return bin.readShort();
  40.891 -    }
  40.892 -
  40.893 -    /**
  40.894 -     * Reads an unsigned 16 bit short.
  40.895 -     *
  40.896 -     * @return  the 16 bit short read.
  40.897 -     * @throws  EOFException If end of file is reached.
  40.898 -     * @throws  IOException If other I/O error has occurred.
  40.899 -     */
  40.900 -    public int readUnsignedShort() throws IOException {
  40.901 -        return bin.readUnsignedShort();
  40.902 -    }
  40.903 -
  40.904 -    /**
  40.905 -     * Reads a 32 bit int.
  40.906 -     *
  40.907 -     * @return  the 32 bit integer read.
  40.908 -     * @throws  EOFException If end of file is reached.
  40.909 -     * @throws  IOException If other I/O error has occurred.
  40.910 -     */
  40.911 -    public int readInt()  throws IOException {
  40.912 -        return bin.readInt();
  40.913 -    }
  40.914 -
  40.915 -    /**
  40.916 -     * Reads a 64 bit long.
  40.917 -     *
  40.918 -     * @return  the read 64 bit long.
  40.919 -     * @throws  EOFException If end of file is reached.
  40.920 -     * @throws  IOException If other I/O error has occurred.
  40.921 -     */
  40.922 -    public long readLong()  throws IOException {
  40.923 -        return bin.readLong();
  40.924 -    }
  40.925 -
  40.926 -    /**
  40.927 -     * Reads a 32 bit float.
  40.928 -     *
  40.929 -     * @return  the 32 bit float read.
  40.930 -     * @throws  EOFException If end of file is reached.
  40.931 -     * @throws  IOException If other I/O error has occurred.
  40.932 -     */
  40.933 -    public float readFloat() throws IOException {
  40.934 -        return bin.readFloat();
  40.935 -    }
  40.936 -
  40.937 -    /**
  40.938 -     * Reads a 64 bit double.
  40.939 -     *
  40.940 -     * @return  the 64 bit double read.
  40.941 -     * @throws  EOFException If end of file is reached.
  40.942 -     * @throws  IOException If other I/O error has occurred.
  40.943 -     */
  40.944 -    public double readDouble() throws IOException {
  40.945 -        return bin.readDouble();
  40.946 -    }
  40.947 -
  40.948 -    /**
  40.949 -     * Reads bytes, blocking until all bytes are read.
  40.950 -     *
  40.951 -     * @param   buf the buffer into which the data is read
  40.952 -     * @throws  EOFException If end of file is reached.
  40.953 -     * @throws  IOException If other I/O error has occurred.
  40.954 -     */
  40.955 -    public void readFully(byte[] buf) throws IOException {
  40.956 -        bin.readFully(buf, 0, buf.length, false);
  40.957 -    }