593 */ 594 public boolean equals(Object obj) { 595 return 596 obj != null && 597 obj instanceof DocFlavor && 598 getStringValue().equals (((DocFlavor) obj).getStringValue()); 599 } 600 601 /** 602 * Returns this doc flavor object's string value. 603 */ 604 private String getStringValue() { 605 if (myStringValue == null) { 606 myStringValue = myMimeType + "; class=\"" + myClassName + "\""; 607 } 608 return myStringValue; 609 } 610 611 /** 612 * Write the instance to a stream (ie serialize the object). 613 */ 614 private void writeObject(ObjectOutputStream s) throws IOException { 615 616 s.defaultWriteObject(); 617 s.writeObject(myMimeType.getMimeType()); 618 } 619 620 /** 621 * Reconstitute an instance from a stream (that is, deserialize it). 622 * 623 * @serialData 624 * The serialised form of a DocFlavor is the String naming the 625 * representation class followed by the String representing the canonical 626 * form of the mime type. 627 */ 628 private void readObject(ObjectInputStream s) 629 throws ClassNotFoundException, IOException { 630 631 s.defaultReadObject(); 632 myMimeType = new MimeType((String)s.readObject()); 633 } 634 635 /** 636 * Class DocFlavor.BYTE_ARRAY provides predefined static constant 637 * DocFlavor objects for example doc flavors using a byte array 638 * (<CODE>byte[]</CODE>) as the print data representation class. 639 * 640 * @author Alan Kaminsky 641 */ 642 public static class BYTE_ARRAY extends DocFlavor { | 593 */ 594 public boolean equals(Object obj) { 595 return 596 obj != null && 597 obj instanceof DocFlavor && 598 getStringValue().equals (((DocFlavor) obj).getStringValue()); 599 } 600 601 /** 602 * Returns this doc flavor object's string value. 603 */ 604 private String getStringValue() { 605 if (myStringValue == null) { 606 myStringValue = myMimeType + "; class=\"" + myClassName + "\""; 607 } 608 return myStringValue; 609 } 610 611 /** 612 * Write the instance to a stream (ie serialize the object). 613 * 614 * @throws IOException if I/O errors occur while writing to the underlying 615 * stream 616 */ 617 private void writeObject(ObjectOutputStream s) throws IOException { 618 619 s.defaultWriteObject(); 620 s.writeObject(myMimeType.getMimeType()); 621 } 622 623 /** 624 * Reconstitute an instance from a stream (that is, deserialize it). 625 * 626 * @throws ClassNotFoundException if the class of a serialized object could 627 * not be found. 628 * @throws IOException if I/O errors occur while reading from the underlying 629 * stream 630 * @serialData 631 * The serialised form of a DocFlavor is the String naming the 632 * representation class followed by the String representing the canonical 633 * form of the mime type. 634 */ 635 private void readObject(ObjectInputStream s) 636 throws ClassNotFoundException, IOException { 637 638 s.defaultReadObject(); 639 myMimeType = new MimeType((String)s.readObject()); 640 } 641 642 /** 643 * Class DocFlavor.BYTE_ARRAY provides predefined static constant 644 * DocFlavor objects for example doc flavors using a byte array 645 * (<CODE>byte[]</CODE>) as the print data representation class. 646 * 647 * @author Alan Kaminsky 648 */ 649 public static class BYTE_ARRAY extends DocFlavor { |