Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void write(String inputFile, com.juliar.codegenerator.InstructionInvocation invocation) throws IOException
        public virtual void write(string inputFile, InstructionInvocation invocation)
        {
            string fileName = getLibiraryName(inputFile);

            try (OutputStream ostream = new FileOutputStream(fileName); ObjectOutputStream p = new ObjectOutputStream(ostream)
                 )
                {
                    p.writeObject(invocation);
                    p.flush();
                }
            catch (IOException e)
            {
                JuliarLogger.log(e);
            }
        }
Exemplo n.º 2
0
        public virtual InstructionInvocation read(string inputFile)
        {
            string libName = getLibiraryName(inputFile);
            InstructionInvocation invocation = null;
            object @object = null;

            try (FileInputStream istream = new FileInputStream(libName); ObjectInputStream s = new ObjectInputStream(istream)
                 )
                {
                    @object = s.readObject();
                    if (@object is InstructionInvocation)
                    {
                        invocation = (InstructionInvocation)@object;
                    }
                }
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java 'multi-catch' syntax:
            catch (IOException | ClassNotFoundException e)
            {
                JuliarLogger.log(e);
            }
            return(invocation);
        }