699 * The returned object is a cookie for Fixups.finishRefs, which
700 * must be used to harden any references into integer indexes.
701 */
702 public Object unparse(ValueStream in, ByteArrayOutputStream out) {
703 Object[] fixups = { null };
704 unparseUsing(getEntryPoint(), fixups, in, out);
705 return fixups[0]; // return ref-bearing cookie, if any
706 }
707
708 public String layoutForClassVersion(Package.Version vers) {
709 if (vers.lessThan(JAVA6_MAX_CLASS_VERSION)) {
710 // Disallow layout syntax in the oldest protocol version.
711 return expandCaseDashNotation(layout);
712 }
713 return layout;
714 }
715 }
716
717 public static
718 class FormatException extends IOException {
719 private static final long serialVersionUID = -2542243830788066513L;
720
721 private int ctype;
722 private String name;
723 String layout;
724 public FormatException(String message,
725 int ctype, String name, String layout) {
726 super(ATTR_CONTEXT_NAME[ctype]+ " attribute \"" + name + "\"" +
727 (message == null? "" : (": " + message)));
728 this.ctype = ctype;
729 this.name = name;
730 this.layout = layout;
731 }
732 public FormatException(String message,
733 int ctype, String name) {
734 this(message, ctype, name, null);
735 }
736 }
737
738 void visitRefs(Holder holder, int mode, final Collection<Entry> refs) {
|
699 * The returned object is a cookie for Fixups.finishRefs, which
700 * must be used to harden any references into integer indexes.
701 */
702 public Object unparse(ValueStream in, ByteArrayOutputStream out) {
703 Object[] fixups = { null };
704 unparseUsing(getEntryPoint(), fixups, in, out);
705 return fixups[0]; // return ref-bearing cookie, if any
706 }
707
708 public String layoutForClassVersion(Package.Version vers) {
709 if (vers.lessThan(JAVA6_MAX_CLASS_VERSION)) {
710 // Disallow layout syntax in the oldest protocol version.
711 return expandCaseDashNotation(layout);
712 }
713 return layout;
714 }
715 }
716
717 public static
718 class FormatException extends IOException {
719 @java.io.Serial
720 private static final long serialVersionUID = -2542243830788066513L;
721
722 private int ctype;
723 private String name;
724 String layout;
725 public FormatException(String message,
726 int ctype, String name, String layout) {
727 super(ATTR_CONTEXT_NAME[ctype]+ " attribute \"" + name + "\"" +
728 (message == null? "" : (": " + message)));
729 this.ctype = ctype;
730 this.name = name;
731 this.layout = layout;
732 }
733 public FormatException(String message,
734 int ctype, String name) {
735 this(message, ctype, name, null);
736 }
737 }
738
739 void visitRefs(Holder holder, int mode, final Collection<Entry> refs) {
|