From: Holger Z. <hz...@us...> - 2004-07-12 20:47:19
|
Update of /cvsroot/jake2/jake2/src/jake2/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12643/src/jake2/util Modified Files: Lib.java Log Message: cleanups Index: Lib.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/util/Lib.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Lib.java 9 Jul 2004 06:50:51 -0000 1.3 --- Lib.java 12 Jul 2004 20:47:01 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- package jake2.util; + import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; *************** *** 30,36 **** import java.io.*; import java.nio.*; - import java.nio.ByteBuffer; - import java.nio.FloatBuffer; - import java.util.Arrays; import java.util.StringTokenizer; --- 31,34 ---- *************** *** 159,173 **** } ! public static String readString(RandomAccessFile file, int len) throws IOException { ! byte buf[] = new byte[len]; ! ! file.read(buf, 0, len); ! return new String(buf, 0, strlen(buf)); ! } ! ! public static String readString(ByteBuffer bb, int len) throws IOException { ! byte buf[] = new byte[len]; ! bb.get(buf); ! return new String(buf, 0, strlen(buf)); } --- 157,164 ---- } ! static byte[] buffer = new byte[Defines.MAX_INFO_STRING]; ! public static String readString(ByteBuffer bb, int len) { ! bb.get(buffer, 0, len); ! return new String(buffer, 0, len); } *************** *** 237,253 **** } ! public static void memset(byte[] dest, byte c, int len) { ! Arrays.fill(dest, 0, len, c); ! } ! ! public static void memset(byte[] dest, int c, int len) { ! Arrays.fill(dest, 0, len, (byte) c); ! } ! ! public static void memcpy(byte[] bs, byte[] bs2, int i) { ! System.arraycopy(bs2, 0, bs, 0, i); ! } ! ! static byte nullfiller[] = new byte[8192]; public static void fwriteString(String s, int len, RandomAccessFile f) throws IOException { --- 228,232 ---- } ! static final byte nullfiller[] = new byte[8192]; public static void fwriteString(String s, int len, RandomAccessFile f) throws IOException { *************** *** 367,415 **** } - public static long[] clone(long in[]) { - long out[] = new long[in.length]; - - if (in.length != 0) - System.arraycopy(in, 0, out, 0, in.length); - - return out; - } - - public static boolean[] clone(boolean in[]) { - boolean out[] = new boolean[in.length]; - - if (in.length != 0) - System.arraycopy(in, 0, out, 0, in.length); - - return out; - } - - public static int[] clone(int in[]) { - int out[] = new int[in.length]; - - if (in.length != 0) - System.arraycopy(in, 0, out, 0, in.length); - - return out; - } - - public static double[] clone(double in[]) { - double out[] = new double[in.length]; - - if (in.length != 0) - System.arraycopy(in, 0, out, 0, in.length); - - return out; - } - - // this works with Strings also. - public static String[] clone(String in[]) { - String out[] = new String[in.length]; - if (in.length != 0) - System.arraycopy(in, 0, out, 0, in.length); - - return out; - } - /* * java.nio.* Buffer util functions --- 346,349 ---- |