| 1 32 package net.sf.retrotranslator.runtime.java.lang; 33 34 import java.io.*; 35 import java.nio.CharBuffer ; 36 import net.sf.retrotranslator.runtime.java.io.*; 37 import net.sf.retrotranslator.runtime.java.nio._CharBuffer; 38 39 42 public class _Appendable { 43 44 public static boolean executeInstanceOfInstruction(Object object) { 45 return object instanceof StringBuffer || 46 object instanceof PrintStream || 47 object instanceof Writer || 48 object instanceof CharBuffer || 49 object instanceof Appendable_; 50 } 51 52 public static Object executeCheckCastInstruction(Object object) { 53 if (object instanceof StringBuffer ) { 54 return (StringBuffer ) object; 55 } 56 if (object instanceof PrintStream) { 57 return (PrintStream) object; 58 } 59 if (object instanceof Writer) { 60 return (Writer) object; 61 } 62 if (object instanceof CharBuffer ) { 63 return (CharBuffer ) object; 64 } 65 return (Appendable_) object; 66 } 67 68 public static Object append(Object object, CharSequence csq) throws IOException { 69 if (object instanceof StringBuffer ) { 70 return _StringBuffer.append((StringBuffer ) object, csq); 71 } 72 if (object instanceof PrintStream) { 73 return _PrintStream.append((PrintStream) object, csq); 74 } 75 if (object instanceof Writer) { 76 return _Writer.append((Writer) object, csq); 77 } 78 if (object instanceof CharBuffer ) { 79 return _CharBuffer.append((CharBuffer ) object, csq); 80 } 81 return ((Appendable_) object).append(csq); 82 } 83 84 public static Object append(Object object, CharSequence csq, int start, int end) throws IOException { 85 if (object instanceof StringBuffer ) { 86 return _StringBuffer.append((StringBuffer ) object, csq, start, end); 87 } 88 if (object instanceof PrintStream) { 89 return _PrintStream.append((PrintStream) object, csq, start, end); 90 } 91 if (object instanceof Writer) { 92 return _Writer.append((Writer) object, csq, start, end); 93 } 94 if (object instanceof CharBuffer ) { 95 return _CharBuffer.append((CharBuffer ) object, csq, start, end); 96 } 97 return ((Appendable_) object).append(csq, start, end); 98 } 99 100 public static Object append(Object object, char c) throws IOException { 101 if (object instanceof StringBuffer ) { 102 return ((StringBuffer ) object).append(c); 103 } 104 if (object instanceof PrintStream) { 105 return _PrintStream.append((PrintStream) object, c); 106 } 107 if (object instanceof Writer) { 108 return _Writer.append((Writer) object, c); 109 } 110 if (object instanceof CharBuffer ) { 111 return _CharBuffer.append((CharBuffer ) object, c); 112 } 113 return ((Appendable_) object).append(c); 114 } 115 116 } 117 | Popular Tags |