private SwfImageUtils.JPEG loadJPEG(SaxAttributesSupport attributes) { if (hasAttribute(attributes, "encoding")) { if (!getAttribute(attributes, "encoding").Equals("base64")) { //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'" fatalError(new SAXParseException("unknown encoding " + getAttribute(attributes, "encoding"), locator)); } if (hasAttribute(attributes, "src")) { //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'" fatalError(new SAXParseException("can only specify one of src or encoding attributes", locator)); } text = new System.Text.StringBuilder(); } else { text = null; if (!hasAttribute(attributes, "src")) { //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'" fatalError(new SAXParseException("must provide either src or encoding attribute", locator)); } try { System.IO.FileInfo src = new System.IO.FileInfo(getAttribute(attributes, "src")); //UPGRADE_TODO: Constructor 'java.io.FileInputStream.FileInputStream' was converted to 'System.IO.FileStream.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileInputStreamFileInputStream_javalangString'" System.IO.FileStream input = new System.IO.FileStream(getAttribute(attributes, "src"), System.IO.FileMode.Open, System.IO.FileAccess.Read); sbyte[] image = new sbyte[(int) SupportClass.FileLength(src)]; SupportClass.ReadInput(input, image, 0, image.Length); input.Close(); SwfImageUtils.JPEG jpeg = new SwfImageUtils.JPEG(image, true); if (!jpeg.validate()) { //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'" fatalError(new SAXParseException("Invalid JPEG data in " + src.Name, locator)); } return jpeg; } catch (System.IO.IOException e) { //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'" //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" throw new SAXParseException(e.Message, locator); } } return null; }
//private byte[] jpegTable = null; public override void defineBits(DefineBits tag) { if (tag.jpegTables == null) { //UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'" out_Renamed.WriteLine("<!-- warning: no JPEG table tag found. -->"); } open(tag); out_Renamed.Write(" id='" + id(tag) + "'"); if (external) { System.String path = externalDirectory + externalPrefix + "image" + dict.getId(tag) + ".jpg"; //UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'" out_Renamed.WriteLine(" src='" + path + "' />"); try { //UPGRADE_TODO: Constructor 'java.io.FileOutputStream.FileOutputStream' was converted to 'System.IO.FileStream.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileOutputStreamFileOutputStream_javalangString_boolean'" System.IO.FileStream image = SupportClass.GetFileStream(path, false); SwfImageUtils.JPEG jpeg = new SwfImageUtils.JPEG(tag.jpegTables.data, tag.data); jpeg.write(image); image.Close(); } catch (System.IO.IOException e) { //UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'" out_Renamed.WriteLine("<!-- error: unable to write external asset file " + path + "-->"); } } else { out_Renamed.Write(" encoding='base64'"); end(); outputBase64(tag.data); close(tag); } }