git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
code cleanup + BufInputStream.is()
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
serial
/
CustomSerializer.java
diff --git
a/src/be/nikiroo/utils/serial/CustomSerializer.java
b/src/be/nikiroo/utils/serial/CustomSerializer.java
index c5876ce401b622788f53ca073ced5e89d7ca56c2..fe63f71903619c6ae49f7fa8d765ddf0b2858f0a 100644
(file)
--- a/
src/be/nikiroo/utils/serial/CustomSerializer.java
+++ b/
src/be/nikiroo/utils/serial/CustomSerializer.java
@@
-5,6
+5,7
@@
import java.io.InputStream;
import java.io.OutputStream;
import be.nikiroo.utils.IOUtils;
import java.io.OutputStream;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.streams.BufferedInputStream;
import be.nikiroo.utils.streams.NextableInputStream;
import be.nikiroo.utils.streams.NextableInputStreamStep;
import be.nikiroo.utils.streams.ReplaceInputStream;
import be.nikiroo.utils.streams.NextableInputStream;
import be.nikiroo.utils.streams.NextableInputStreamStep;
import be.nikiroo.utils.streams.ReplaceInputStream;
@@
-160,6
+161,8
@@
public abstract class CustomSerializer {
}
}
}
}
+ /** Use {@link CustomSerializer#isCustom(BufferedInputStream)}. */
+ @Deprecated
public static boolean isCustom(String encodedValue) {
int pos1 = encodedValue.indexOf('^');
int pos2 = encodedValue.indexOf('^', pos1 + 1);
public static boolean isCustom(String encodedValue) {
int pos1 = encodedValue.indexOf('^');
int pos2 = encodedValue.indexOf('^', pos1 + 1);
@@
-167,6
+170,10
@@
public abstract class CustomSerializer {
return pos1 >= 0 && pos2 >= 0 && encodedValue.startsWith("custom^");
}
return pos1 >= 0 && pos2 >= 0 && encodedValue.startsWith("custom^");
}
+ public static boolean isCustom(BufferedInputStream in) throws IOException {
+ return in.startsWiths("custom^");
+ }
+
public static String typeOf(String encodedValue) {
int pos1 = encodedValue.indexOf('^');
int pos2 = encodedValue.indexOf('^', pos1 + 1);
public static String typeOf(String encodedValue) {
int pos1 = encodedValue.indexOf('^');
int pos2 = encodedValue.indexOf('^', pos1 + 1);
@@
-174,12
+181,4
@@
public abstract class CustomSerializer {
return type;
}
return type;
}
-
- public static String contentOf(String encodedValue) {
- int pos1 = encodedValue.indexOf('^');
- int pos2 = encodedValue.indexOf('^', pos1 + 1);
- String encodedContent = encodedValue.substring(pos2 + 1);
-
- return encodedContent;
- }
}
}