Home | History | Annotate | Download | only in Antlr3.Runtime.JavaExtensions
      1 /*
      2  * [The "BSD licence"]
      3  * Copyright (c) 2005-2008 Terence Parr
      4  * All rights reserved.
      5  *
      6  * Conversion to C#:
      7  * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc.
      8  * All rights reserved.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 namespace Antlr.Runtime.JavaExtensions
     34 {
     35     using System;
     36     using System.IO;
     37 
     38     public static class JSystem
     39     {
     40         [Obsolete]
     41         public static TextWriter err
     42         {
     43             get
     44             {
     45                 return Console.Error;
     46             }
     47         }
     48 
     49         [Obsolete]
     50         public static TextWriter @out
     51         {
     52             get
     53             {
     54                 return Console.Out;
     55             }
     56         }
     57 
     58         [Obsolete]
     59         public static void arraycopy<T>( T[] sourceArray, int sourceIndex, T[] destinationArray, int destinationIndex, int length )
     60         {
     61             Array.Copy( sourceArray, sourceIndex, destinationArray, destinationIndex, length );
     62         }
     63 
     64         [Obsolete]
     65         public static string getProperty( string name )
     66         {
     67             switch ( name )
     68             {
     69             case "file.encoding":
     70                 return System.Text.Encoding.Default.WebName;
     71 
     72             case "line.separator":
     73                 return Environment.NewLine;
     74 
     75             case "java.io.tmpdir":
     76                 return System.IO.Path.GetTempPath();
     77 
     78             case "user.home":
     79                 return Environment.GetFolderPath( Environment.SpecialFolder.Personal );
     80 
     81             default:
     82                 throw new ArgumentException( string.Format( "Unknown system property: '{0}'", name ) );
     83             }
     84         }
     85 
     86     }
     87 }
     88