X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fstreams%2FStreamUtils.java;fp=src%2Fbe%2Fnikiroo%2Futils%2Fstreams%2FStreamUtils.java;h=0000000000000000000000000000000000000000;hb=ad207feb2815e429ae32484bc6930990099f8ea4;hp=dc75090858fb56f36ecc808eb48a9819056871d5;hpb=1b5197ed4ceec2025a9a40c417b37c646b756138;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/streams/StreamUtils.java b/src/be/nikiroo/utils/streams/StreamUtils.java deleted file mode 100644 index dc75090..0000000 --- a/src/be/nikiroo/utils/streams/StreamUtils.java +++ /dev/null @@ -1,69 +0,0 @@ -package be.nikiroo.utils.streams; - -import be.nikiroo.utils.StringUtils; - -/** - * Some non-public utilities used in the stream classes. - * - * @author niki - */ -class StreamUtils { - /** - * Check if the buffer starts with the given search term (given as an array, - * a start position and an end position). - *

- * Note: the parameter stop is the index of the last - * position, not the length. - *

- * Note: the search term size must be smaller or equal the internal - * buffer size. - * - * @param search - * the term to search for - * @param buffer - * the buffer to look into - * @param start - * the offset at which to start the search - * @param stop - * the maximum index of the data to check (this is not a - * length, but an index) - * - * @return TRUE if the search content is present at the given location and - * does not exceed the len index - */ - static public boolean startsWith(byte[] search, byte[] buffer, int start, - int stop) { - - // Check if there even is enough space for it - if (search.length > (stop - start)) { - return false; - } - - boolean same = true; - for (int i = 0; i < search.length; i++) { - if (search[i] != buffer[start + i]) { - same = false; - break; - } - } - - return same; - } - - /** - * Return the bytes array representation of the given {@link String} in - * UTF-8. - * - * @param strs - * the {@link String}s to transform into bytes - * @return the content in bytes - */ - static public byte[][] getBytes(String[] strs) { - byte[][] bytes = new byte[strs.length][]; - for (int i = 0; i < strs.length; i++) { - bytes[i] = StringUtils.getBytes(strs[i]); - } - - return bytes; - } -}