using System; using System.Text; /// /// This class was first written by Drew Noakes in Java. /// /// This is public domain software - that is, you can do whatever you want /// with it, and include it software that is licensed under the GNU or the /// BSD license, or whatever other licence you choose, including proprietary /// closed source licenses. I do ask that you leave this header in tact. /// /// The C# class was made by Ferret Renaud: /// renaud91@free.fr /// If you find a bug in the C# code, feel free to mail me. /// namespace com.utils { /// /// Class that try to recreate some Java functionnalities. /// public sealed class Utils { /// /// Constructor of the object /// /// always private Utils() { throw new UnauthorizedAccessException("Do not use"); } /// /// Builds a string from a byte array /// /// the array of byte /// where to start /// the length to transform in string /// if true, spaces will be avoid /// a string representing the array of byte public static string Decode(byte[] anArray, int offset, int length, bool removeSpace) { StringBuilder sb = new StringBuilder(length); for(int i=offset; i /// Builds a string from a byte array /// /// the array of byte /// if true, spaces will be avoid /// a string representing the array of byte public static string Decode(byte[] anArray, bool removeSpace) { return Decode(anArray, 0, anArray.Length, removeSpace); } } }