aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/util/Lib.java
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2004-11-07 19:30:12 +0000
committerCarsten Weisse <[email protected]>2004-11-07 19:30:12 +0000
commit381500add86590eeaf629d9b933aa87815be43f1 (patch)
tree0816ed7c103187b9a0504771d40d0ee2eae0bef2 /src/jake2/util/Lib.java
parenta14fc96bf2af664ec1d570f7baf22dcfe9fdeacc (diff)
string conversion funktions
Diffstat (limited to 'src/jake2/util/Lib.java')
-rw-r--r--src/jake2/util/Lib.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java
index c31d161..1393e67 100644
--- a/src/jake2/util/Lib.java
+++ b/src/jake2/util/Lib.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 09.12.2003 by RST.
-// $Id: Lib.java,v 1.8 2004-10-07 14:12:59 hzi Exp $
+// $Id: Lib.java,v 1.9 2004-11-07 19:30:12 cawe Exp $
package jake2.util;
@@ -262,6 +262,19 @@ public class Lib {
return out;
}
+ public static String CtoJava(String old) {
+ int index = old.indexOf('\0');
+ if (index == 0) return "";
+ return (index > 0) ? old.substring(0, index) : old;
+ }
+
+ public static String CtoJava(byte[] old, int offset, int maxLenght) {
+ int i;
+ for (i = offset; old[i] != 0 && i < maxLenght; i++);
+ return new String(old, offset, i - offset);
+ }
+
+
/*
* java.nio.* Buffer util functions
*/