java.lang.Object
java.beans.XMLDecoder
- See Also:
- Top Examples, Source Code,
XMLEncoder
,
ObjectInputStream
public void close()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[413]Transform between JavaBean and XML automatically
By neino { at } wp { dot } pl on 2004/11/16 07:52:22 Rate
import java.io.*;
import java.beans.*;
import java.awt.Point;
public class SampleTest {
public static void main ( String args [ ] ) throws Exception {
Sample sample = new Sample ( ) ;
sample.setScores ( new int [ ] { 100, 90, 75 } ) ;
sample.setName ( "Gore" ) ;
sample.setSeat ( new Point ( 5, 3 ) ) ;
XMLEncoder encoder = new XMLEncoder (
new BufferedOutputStream (
new FileOutputStream ( "Sample.xml" ) ) ) ;
encoder.writeObject ( sample ) ;
encoder.close ( ) ;
System.out.println ( sample ) ;
XMLDecoder decoder = new XMLDecoder (
new BufferedInputStream (
new FileInputStream ( "Sample.xml" ) ) ) ;
Sample sample2 = ( Sample ) decoder.readObject ( ) ;
decoder.close ( ) ;
System.out.println ( sample2 ) ;
}
}
public ExceptionListener getExceptionListener()
- See Also:
setExceptionListener(java.beans.ExceptionListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object getOwner()
- See Also:
setOwner(java.lang.Object)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object readObject()
- See Also:
XMLEncoder.writeObject(java.lang.Object)
, ArrayIndexOutOfBoundsException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setExceptionListener(ExceptionListener exceptionListener)
- See Also:
getExceptionListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setOwner(Object owner)
- See Also:
getOwner()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public XMLDecoder(InputStream in)
- See Also:
XMLEncoder.XMLEncoder(OutputStream)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public XMLDecoder(InputStream in,
Object owner)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public XMLDecoder(InputStream in,
Object owner,
ExceptionListener exceptionListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public XMLDecoder(InputStream in,
Object owner,
ExceptionListener exceptionListener,
ClassLoader cl)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples