ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [21/50] [abbrv] incubator-ignite git commit: #ignite-315: move zip function to VisorUtils
Date Fri, 27 Feb 2015 11:09:30 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteByteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteByteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteByteUtils.java
deleted file mode 100644
index 793f7ce..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteByteUtils.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.util;
-
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-import java.util.zip.*;
-
-/**
- * Collection of utility methods used throughout the system.
- */
-public class IgniteByteUtils {
-    /**
-     * Writes collection of byte arrays to data output.
-     *
-     * @param out Output to write to.
-     * @param bytes Collection with byte arrays.
-     * @throws java.io.IOException If write failed.
-     */
-    public static void writeBytesCollection(DataOutput out, Collection<byte[]> bytes) throws IOException {
-        if (bytes != null) {
-            out.writeInt(bytes.size());
-
-            for (byte[] b : bytes)
-                writeByteArray(out, b);
-        }
-        else
-            out.writeInt(-1);
-    }
-
-    /**
-     * Reads collection of byte arrays from data input.
-     *
-     * @param in Data input to read from.
-     * @return List of byte arrays.
-     * @throws java.io.IOException If read failed.
-     */
-    public static List<byte[]> readBytesList(DataInput in) throws IOException {
-        int size = in.readInt();
-
-        if (size < 0)
-            return null;
-
-        List<byte[]> res = new ArrayList<>(size);
-
-        for (int i = 0; i < size; i++)
-            res.add(readByteArray(in));
-
-        return res;
-    }
-
-    /**
-     * Writes byte array to output stream accounting for <tt>null</tt> values.
-     *
-     * @param out Output stream to write to.
-     * @param arr Array to write, possibly <tt>null</tt>.
-     * @throws java.io.IOException If write failed.
-     */
-    public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException {
-        if (arr == null)
-            out.writeInt(-1);
-        else {
-            out.writeInt(arr.length);
-
-            out.write(arr);
-        }
-    }
-
-    /**
-     * Writes byte array to output stream accounting for <tt>null</tt> values.
-     *
-     * @param out Output stream to write to.
-     * @param arr Array to write, possibly <tt>null</tt>.
-     * @throws java.io.IOException If write failed.
-     */
-    public static void writeByteArray(DataOutput out, @Nullable byte[] arr, int maxLen) throws IOException {
-        if (arr == null)
-            out.writeInt(-1);
-        else {
-            int len = Math.min(arr.length, maxLen);
-
-            out.writeInt(len);
-
-            out.write(arr, 0, len);
-        }
-    }
-
-    /**
-     * Reads byte array from input stream accounting for <tt>null</tt> values.
-     *
-     * @param in Stream to read from.
-     * @return Read byte array, possibly <tt>null</tt>.
-     * @throws java.io.IOException If read failed.
-     */
-    @Nullable public static byte[] readByteArray(DataInput in) throws IOException {
-        int len = in.readInt();
-
-        if (len == -1)
-            return null; // Value "-1" indicates null.
-
-        byte[] res = new byte[len];
-
-        in.readFully(res);
-
-        return res;
-    }
-
-    /**
-     * Reads byte array from given buffers (changing buffer positions).
-     *
-     * @param bufs Byte buffers.
-     * @return Byte array.
-     */
-    public static byte[] readByteArray(ByteBuffer... bufs) {
-        assert !F.isEmpty(bufs);
-
-        int size = 0;
-
-        for (ByteBuffer buf : bufs)
-            size += buf.remaining();
-
-        byte[] res = new byte[size];
-
-        int off = 0;
-
-        for (ByteBuffer buf : bufs) {
-            int len = buf.remaining();
-
-            if (len != 0) {
-                buf.get(res, off, len);
-
-                off += len;
-            }
-        }
-
-        assert off == res.length;
-
-        return res;
-    }
-
-    /**
-     * // FIXME: added for DR dataCenterIds, review if it is needed after GG-6879.
-     *
-     * @param out Output.
-     * @param col Set to write.
-     * @throws java.io.IOException If write failed.
-     */
-    public static void writeByteCollection(DataOutput out, Collection<Byte> col) throws IOException {
-        if (col != null) {
-            out.writeInt(col.size());
-
-            for (Byte i : col)
-                out.writeByte(i);
-        }
-        else
-            out.writeInt(-1);
-    }
-
-    /**
-     * // FIXME: added for DR dataCenterIds, review if it is needed after GG-6879.
-     *
-     * @param in Input.
-     * @return Deserialized list.
-     * @throws java.io.IOException If deserialization failed.
-     */
-    @Nullable public static List<Byte> readByteList(DataInput in) throws IOException {
-        int size = in.readInt();
-
-        // Check null flag.
-        if (size == -1)
-            return null;
-
-        List<Byte> col = new ArrayList<>(size);
-
-        for (int i = 0; i < size; i++)
-            col.add(in.readByte());
-
-        return col;
-    }
-
-    /**
-     * Join byte arrays into single one.
-     *
-     * @param bufs list of byte arrays to concatenate.
-     * @return Concatenated byte's array.
-     */
-    public static byte[] join(byte[]... bufs) {
-        int size = 0;
-        for (byte[] buf : bufs) {
-            size += buf.length;
-        }
-
-        byte[] res = new byte[size];
-        int position = 0;
-        for (byte[] buf : bufs) {
-            IgniteUtils.arrayCopy(buf, 0, res, position, buf.length);
-            position += buf.length;
-        }
-
-        return res;
-    }
-
-    /**
-     * Converts byte array to formatted string. If calling:
-     * <pre name="code" class="java">
-     * ...
-     * byte[] data = {10, 20, 30, 40, 50, 60, 70, 80, 90};
-     *
-     * U.byteArray2String(data, "0x%02X", ",0x%02X")
-     * ...
-     * </pre>
-     * the result will be:
-     * <pre name="code" class="java">
-     * ...
-     * 0x0A, 0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A
-     * ...
-     * </pre>
-     *
-     * @param arr Array of byte.
-     * @param hdrFmt C-style string format for the first element.
-     * @param bodyFmt C-style string format for second and following elements, if any.
-     * @return String with converted bytes.
-     */
-    public static String byteArray2String(byte[] arr, String hdrFmt, String bodyFmt) {
-        assert arr != null;
-        assert hdrFmt != null;
-        assert bodyFmt != null;
-
-        SB sb = new SB();
-
-        sb.a('{');
-
-        boolean first = true;
-
-        for (byte b : arr)
-            if (first) {
-                sb.a(String.format(hdrFmt, b));
-
-                first = false;
-            }
-            else
-                sb.a(String.format(bodyFmt, b));
-
-        sb.a('}');
-
-        return sb.toString();
-    }
-
-    /**
-     * Convert string with hex values to byte array.
-     *
-     * @param hex Hexadecimal string to convert.
-     * @return array of bytes defined as hex in string.
-     * @throws IllegalArgumentException If input character differs from certain hex characters.
-     */
-    public static byte[] hexString2ByteArray(String hex) throws IllegalArgumentException {
-        // If Hex string has odd character length.
-        if (hex.length() % 2 != 0)
-            hex = '0' + hex;
-
-        char[] chars = hex.toCharArray();
-
-        byte[] bytes = new byte[chars.length / 2];
-
-        int byteCnt = 0;
-
-        for (int i = 0; i < chars.length; i += 2) {
-            int newByte = 0;
-
-            newByte |= hexCharToByte(chars[i]);
-
-            newByte <<= 4;
-
-            newByte |= hexCharToByte(chars[i + 1]);
-
-            bytes[byteCnt] = (byte)newByte;
-
-            byteCnt++;
-        }
-
-        return bytes;
-    }
-
-    /**
-     * Return byte value for certain character.
-     *
-     * @param ch Character
-     * @return Byte value.
-     * @throws IllegalArgumentException If input character differ from certain hex characters.
-     */
-    @SuppressWarnings({"UnnecessaryFullyQualifiedName", "fallthrough"})
-    private static byte hexCharToByte(char ch) throws IllegalArgumentException {
-        switch (ch) {
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                return (byte)(ch - '0');
-
-            case 'a':
-            case 'A':
-                return 0xa;
-
-            case 'b':
-            case 'B':
-                return 0xb;
-
-            case 'c':
-            case 'C':
-                return 0xc;
-
-            case 'd':
-            case 'D':
-                return 0xd;
-
-            case 'e':
-            case 'E':
-                return 0xe;
-
-            case 'f':
-            case 'F':
-                return 0xf;
-
-            default:
-                throw new IllegalArgumentException("Hex decoding wrong input character [character=" + ch + ']');
-        }
-    }
-
-    /**
-     * Converts primitive double to byte array.
-     *
-     * @param d Double to convert.
-     * @return Byte array.
-     */
-    public static byte[] doubleToBytes(double d) {
-        return longToBytes(Double.doubleToLongBits(d));
-    }
-
-    /**
-     * Converts primitive {@code double} type to byte array and stores
-     * it in the specified byte array.
-     *
-     * @param d Double to convert.
-     * @param bytes Array of bytes.
-     * @param off Offset.
-     * @return New offset.
-     */
-    public static int doubleToBytes(double d, byte[] bytes, int off) {
-        return longToBytes(Double.doubleToLongBits(d), bytes, off);
-    }
-
-    /**
-     * Converts primitive float to byte array.
-     *
-     * @param f Float to convert.
-     * @return Array of bytes.
-     */
-    public static byte[] floatToBytes(float f) {
-        return intToBytes(Float.floatToIntBits(f));
-    }
-
-    /**
-     * Converts primitive float to byte array.
-     *
-     * @param f Float to convert.
-     * @param bytes Array of bytes.
-     * @param off Offset.
-     * @return New offset.
-     */
-    public static int floatToBytes(float f, byte[] bytes, int off) {
-        return intToBytes(Float.floatToIntBits(f), bytes, off);
-    }
-
-    /**
-     * Converts primitive {@code long} type to byte array.
-     *
-     * @param l Long value.
-     * @return Array of bytes.
-     */
-    public static byte[] longToBytes(long l) {
-        return GridClientByteUtils.longToBytes(l);
-    }
-
-    /**
-     * Converts primitive {@code long} type to byte array and stores it in specified
-     * byte array.
-     *
-     * @param l Long value.
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Number of bytes overwritten in {@code bytes} array.
-     */
-    public static int longToBytes(long l, byte[] bytes, int off) {
-        return off + GridClientByteUtils.longToBytes(l, bytes, off);
-    }
-
-    /**
-     * Converts primitive {@code int} type to byte array.
-     *
-     * @param i Integer value.
-     * @return Array of bytes.
-     */
-    public static byte[] intToBytes(int i) {
-        return GridClientByteUtils.intToBytes(i);
-    }
-
-    /**
-     * Converts primitive {@code int} type to byte array and stores it in specified
-     * byte array.
-     *
-     * @param i Integer value.
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Number of bytes overwritten in {@code bytes} array.
-     */
-    public static int intToBytes(int i, byte[] bytes, int off) {
-        return off + GridClientByteUtils.intToBytes(i, bytes, off);
-    }
-
-    /**
-     * Converts primitive {@code short} type to byte array.
-     *
-     * @param s Short value.
-     * @return Array of bytes.
-     */
-    public static byte[] shortToBytes(short s) {
-        return GridClientByteUtils.shortToBytes(s);
-    }
-
-    /**
-     * Converts primitive {@code short} type to byte array and stores it in specified
-     * byte array.
-     *
-     * @param s Short value.
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Number of bytes overwritten in {@code bytes} array.
-     */
-    public static int shortToBytes(short s, byte[] bytes, int off) {
-        return off + GridClientByteUtils.shortToBytes(s, bytes, off);
-    }
-
-    /**
-     * Encodes {@link java.util.UUID} into a sequence of bytes using the {@link java.nio.ByteBuffer},
-     * storing the result into a new byte array.
-     *
-     * @param uuid Unique identifier.
-     * @param arr Byte array to fill with result.
-     * @param off Offset in {@code arr}.
-     * @return Number of bytes overwritten in {@code bytes} array.
-     */
-    public static int uuidToBytes(@Nullable UUID uuid, byte[] arr, int off) {
-        return off + GridClientByteUtils.uuidToBytes(uuid, arr, off);
-    }
-
-    /**
-     * Converts an UUID to byte array.
-     *
-     * @param uuid UUID value.
-     * @return Encoded into byte array {@link java.util.UUID}.
-     */
-    public static byte[] uuidToBytes(@Nullable UUID uuid) {
-        return GridClientByteUtils.uuidToBytes(uuid);
-    }
-
-    /**
-     * Constructs {@code short} from byte array.
-     *
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Short value.
-     */
-    public static short bytesToShort(byte[] bytes, int off) {
-        assert bytes != null;
-
-        int bytesCnt = Short.SIZE >> 3;
-
-        if (off + bytesCnt > bytes.length)
-            // Just use the remainder.
-            bytesCnt = bytes.length - off;
-
-        short res = 0;
-
-        for (int i = 0; i < bytesCnt; i++) {
-            int shift = bytesCnt - i - 1 << 3;
-
-            res |= (0xffL & bytes[off++]) << shift;
-        }
-
-        return res;
-    }
-
-    /**
-     * Constructs {@code int} from byte array.
-     *
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Integer value.
-     */
-    public static int bytesToInt(byte[] bytes, int off) {
-        assert bytes != null;
-
-        int bytesCnt = Integer.SIZE >> 3;
-
-        if (off + bytesCnt > bytes.length)
-            // Just use the remainder.
-            bytesCnt = bytes.length - off;
-
-        int res = 0;
-
-        for (int i = 0; i < bytesCnt; i++) {
-            int shift = bytesCnt - i - 1 << 3;
-
-            res |= (0xffL & bytes[off++]) << shift;
-        }
-
-        return res;
-    }
-
-    /**
-     * Constructs {@code long} from byte array.
-     *
-     * @param bytes Array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return Long value.
-     */
-    public static long bytesToLong(byte[] bytes, int off) {
-        assert bytes != null;
-
-        int bytesCnt = Long.SIZE >> 3;
-
-        if (off + bytesCnt > bytes.length)
-            bytesCnt = bytes.length - off;
-
-        long res = 0;
-
-        for (int i = 0; i < bytesCnt; i++) {
-            int shift = bytesCnt - i - 1 << 3;
-
-            res |= (0xffL & bytes[off++]) << shift;
-        }
-
-        return res;
-    }
-
-    /**
-     * Reads an {@link java.util.UUID} form byte array.
-     * If given array contains all 0s then {@code null} will be returned.
-     *
-     * @param bytes array of bytes.
-     * @param off Offset in {@code bytes} array.
-     * @return UUID value or {@code null}.
-     */
-    public static UUID bytesToUuid(byte[] bytes, int off) {
-        return GridClientByteUtils.bytesToUuid(bytes, off);
-    }
-
-    /**
-     * Constructs double from byte array.
-     *
-     * @param bytes Byte array.
-     * @param off Offset in {@code bytes} array.
-     * @return Double value.
-     */
-    public static double bytesToDouble(byte[] bytes, int off) {
-        return Double.longBitsToDouble(bytesToLong(bytes, off));
-    }
-
-    /**
-     * Constructs float from byte array.
-     *
-     * @param bytes Byte array.
-     * @param off Offset in {@code bytes} array.
-     * @return Float value.
-     */
-    public static float bytesToFloat(byte[] bytes, int off) {
-        return Float.intBitsToFloat(bytesToInt(bytes, off));
-    }
-
-    /**
-     * Compares fragments of byte arrays.
-     *
-     * @param a First array.
-     * @param aOff First array offset.
-     * @param b Second array.
-     * @param bOff Second array offset.
-     * @param len Length of fragments.
-     * @return {@code true} if fragments are equal, {@code false} otherwise.
-     */
-    public static boolean bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len) {
-        if (aOff + len > a.length || bOff + len > b.length)
-            return false;
-        else {
-            for (int i = 0; i < len; i++)
-                if (a[aOff + i] != b[bOff + i])
-                    return false;
-
-            return true;
-        }
-    }
-
-    /**
-     * Converts an array of characters representing hexidecimal values into an
-     * array of bytes of those same values. The returned array will be half the
-     * length of the passed array, as it takes two characters to represent any
-     * given byte. An exception is thrown if the passed char array has an odd
-     * number of elements.
-     *
-     * @param data An array of characters containing hexidecimal digits
-     * @return A byte array containing binary data decoded from
-     *         the supplied char array.
-     * @throws org.apache.ignite.IgniteCheckedException Thrown if an odd number or illegal of characters is supplied.
-     */
-    public static byte[] decodeHex(char[] data) throws IgniteCheckedException {
-
-        int len = data.length;
-
-        if ((len & 0x01) != 0)
-            throw new IgniteCheckedException("Odd number of characters.");
-
-        byte[] out = new byte[len >> 1];
-
-        // Two characters form the hex value.
-        for (int i = 0, j = 0; j < len; i++) {
-            int f = IgniteUtils.toDigit(data[j], j) << 4;
-
-            j++;
-
-            f |= IgniteUtils.toDigit(data[j], j);
-
-            j++;
-
-            out[i] = (byte)(f & 0xFF);
-        }
-
-        return out;
-    }
-
-    /**
-     * Zips byte array.
-     *
-     * @param input Input bytes.
-     * @return Zipped byte array.
-     * @throws java.io.IOException If failed.
-     */
-    public static byte[] zipBytes(byte[] input) throws IOException {
-        return zipBytes(input, 4096);
-    }
-
-    /**
-     * Zips byte array.
-     *
-     * @param input Input bytes.
-     * @param initBufSize Initial buffer size.
-     * @return Zipped byte array.
-     * @throws java.io.IOException If failed.
-     */
-    public static byte[] zipBytes(byte[] input, int initBufSize) throws IOException {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream(initBufSize);
-
-        try (ZipOutputStream zos = new ZipOutputStream(bos)) {
-            ZipEntry entry = new ZipEntry("");
-
-            try {
-                entry.setSize(input.length);
-
-                zos.putNextEntry(entry);
-
-                zos.write(input);
-            } finally {
-                zos.closeEntry();
-            }
-        }
-
-        return bos.toByteArray();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index d0158ed..1348bb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -240,7 +240,7 @@ public abstract class IgniteUtils {
         indexOf('.', IgniteUtils.class.getName().indexOf('.') + 1));
 
     /** Network packet header. */
-    public static final byte[] IGNITE_HEADER = IgniteByteUtils.intToBytes(0x00004747);
+    public static final byte[] IGNITE_HEADER = intToBytes(0x00004747);
 
     /** Default buffer size = 4K. */
     private static final int BUF_SIZE = 4096;
@@ -1845,6 +1845,638 @@ public abstract class IgniteUtils {
     }
 
     /**
+     * Writes collection of byte arrays to data output.
+     *
+     * @param out Output to write to.
+     * @param bytes Collection with byte arrays.
+     * @throws java.io.IOException If write failed.
+     */
+    public static void writeBytesCollection(DataOutput out, Collection<byte[]> bytes) throws IOException {
+        if (bytes != null) {
+            out.writeInt(bytes.size());
+
+            for (byte[] b : bytes)
+                writeByteArray(out, b);
+        }
+        else
+            out.writeInt(-1);
+    }
+
+    /**
+     * Reads collection of byte arrays from data input.
+     *
+     * @param in Data input to read from.
+     * @return List of byte arrays.
+     * @throws java.io.IOException If read failed.
+     */
+    public static List<byte[]> readBytesList(DataInput in) throws IOException {
+        int size = in.readInt();
+
+        if (size < 0)
+            return null;
+
+        List<byte[]> res = new ArrayList<>(size);
+
+        for (int i = 0; i < size; i++)
+            res.add(readByteArray(in));
+
+        return res;
+    }
+
+    /**
+     * Writes byte array to output stream accounting for <tt>null</tt> values.
+     *
+     * @param out Output stream to write to.
+     * @param arr Array to write, possibly <tt>null</tt>.
+     * @throws java.io.IOException If write failed.
+     */
+    public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException {
+        if (arr == null)
+            out.writeInt(-1);
+        else {
+            out.writeInt(arr.length);
+
+            out.write(arr);
+        }
+    }
+
+    /**
+     * Writes byte array to output stream accounting for <tt>null</tt> values.
+     *
+     * @param out Output stream to write to.
+     * @param arr Array to write, possibly <tt>null</tt>.
+     * @throws java.io.IOException If write failed.
+     */
+    public static void writeByteArray(DataOutput out, @Nullable byte[] arr, int maxLen) throws IOException {
+        if (arr == null)
+            out.writeInt(-1);
+        else {
+            int len = Math.min(arr.length, maxLen);
+
+            out.writeInt(len);
+
+            out.write(arr, 0, len);
+        }
+    }
+
+    /**
+     * Reads byte array from input stream accounting for <tt>null</tt> values.
+     *
+     * @param in Stream to read from.
+     * @return Read byte array, possibly <tt>null</tt>.
+     * @throws java.io.IOException If read failed.
+     */
+    @Nullable public static byte[] readByteArray(DataInput in) throws IOException {
+        int len = in.readInt();
+
+        if (len == -1)
+            return null; // Value "-1" indicates null.
+
+        byte[] res = new byte[len];
+
+        in.readFully(res);
+
+        return res;
+    }
+
+    /**
+     * Reads byte array from given buffers (changing buffer positions).
+     *
+     * @param bufs Byte buffers.
+     * @return Byte array.
+     */
+    public static byte[] readByteArray(ByteBuffer... bufs) {
+        assert !F.isEmpty(bufs);
+
+        int size = 0;
+
+        for (ByteBuffer buf : bufs)
+            size += buf.remaining();
+
+        byte[] res = new byte[size];
+
+        int off = 0;
+
+        for (ByteBuffer buf : bufs) {
+            int len = buf.remaining();
+
+            if (len != 0) {
+                buf.get(res, off, len);
+
+                off += len;
+            }
+        }
+
+        assert off == res.length;
+
+        return res;
+    }
+
+    /**
+     * // FIXME: added for DR dataCenterIds, review if it is needed after GG-6879.
+     *
+     * @param out Output.
+     * @param col Set to write.
+     * @throws java.io.IOException If write failed.
+     */
+    public static void writeByteCollection(DataOutput out, Collection<Byte> col) throws IOException {
+        if (col != null) {
+            out.writeInt(col.size());
+
+            for (Byte i : col)
+                out.writeByte(i);
+        }
+        else
+            out.writeInt(-1);
+    }
+
+    /**
+     * // FIXME: added for DR dataCenterIds, review if it is needed after GG-6879.
+     *
+     * @param in Input.
+     * @return Deserialized list.
+     * @throws java.io.IOException If deserialization failed.
+     */
+    @Nullable public static List<Byte> readByteList(DataInput in) throws IOException {
+        int size = in.readInt();
+
+        // Check null flag.
+        if (size == -1)
+            return null;
+
+        List<Byte> col = new ArrayList<>(size);
+
+        for (int i = 0; i < size; i++)
+            col.add(in.readByte());
+
+        return col;
+    }
+
+    /**
+     * Join byte arrays into single one.
+     *
+     * @param bufs list of byte arrays to concatenate.
+     * @return Concatenated byte's array.
+     */
+    public static byte[] join(byte[]... bufs) {
+        int size = 0;
+        for (byte[] buf : bufs) {
+            size += buf.length;
+        }
+
+        byte[] res = new byte[size];
+        int position = 0;
+        for (byte[] buf : bufs) {
+            arrayCopy(buf, 0, res, position, buf.length);
+            position += buf.length;
+        }
+
+        return res;
+    }
+
+    /**
+     * Converts byte array to formatted string. If calling:
+     * <pre name="code" class="java">
+     * ...
+     * byte[] data = {10, 20, 30, 40, 50, 60, 70, 80, 90};
+     *
+     * U.byteArray2String(data, "0x%02X", ",0x%02X")
+     * ...
+     * </pre>
+     * the result will be:
+     * <pre name="code" class="java">
+     * ...
+     * 0x0A, 0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A
+     * ...
+     * </pre>
+     *
+     * @param arr Array of byte.
+     * @param hdrFmt C-style string format for the first element.
+     * @param bodyFmt C-style string format for second and following elements, if any.
+     * @return String with converted bytes.
+     */
+    public static String byteArray2String(byte[] arr, String hdrFmt, String bodyFmt) {
+        assert arr != null;
+        assert hdrFmt != null;
+        assert bodyFmt != null;
+
+        SB sb = new SB();
+
+        sb.a('{');
+
+        boolean first = true;
+
+        for (byte b : arr)
+            if (first) {
+                sb.a(String.format(hdrFmt, b));
+
+                first = false;
+            }
+            else
+                sb.a(String.format(bodyFmt, b));
+
+        sb.a('}');
+
+        return sb.toString();
+    }
+
+    /**
+     * Convert string with hex values to byte array.
+     *
+     * @param hex Hexadecimal string to convert.
+     * @return array of bytes defined as hex in string.
+     * @throws IllegalArgumentException If input character differs from certain hex characters.
+     */
+    public static byte[] hexString2ByteArray(String hex) throws IllegalArgumentException {
+        // If Hex string has odd character length.
+        if (hex.length() % 2 != 0)
+            hex = '0' + hex;
+
+        char[] chars = hex.toCharArray();
+
+        byte[] bytes = new byte[chars.length / 2];
+
+        int byteCnt = 0;
+
+        for (int i = 0; i < chars.length; i += 2) {
+            int newByte = 0;
+
+            newByte |= hexCharToByte(chars[i]);
+
+            newByte <<= 4;
+
+            newByte |= hexCharToByte(chars[i + 1]);
+
+            bytes[byteCnt] = (byte)newByte;
+
+            byteCnt++;
+        }
+
+        return bytes;
+    }
+
+    /**
+     * Return byte value for certain character.
+     *
+     * @param ch Character
+     * @return Byte value.
+     * @throws IllegalArgumentException If input character differ from certain hex characters.
+     */
+    @SuppressWarnings({"UnnecessaryFullyQualifiedName", "fallthrough"})
+    private static byte hexCharToByte(char ch) throws IllegalArgumentException {
+        switch (ch) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                return (byte)(ch - '0');
+
+            case 'a':
+            case 'A':
+                return 0xa;
+
+            case 'b':
+            case 'B':
+                return 0xb;
+
+            case 'c':
+            case 'C':
+                return 0xc;
+
+            case 'd':
+            case 'D':
+                return 0xd;
+
+            case 'e':
+            case 'E':
+                return 0xe;
+
+            case 'f':
+            case 'F':
+                return 0xf;
+
+            default:
+                throw new IllegalArgumentException("Hex decoding wrong input character [character=" + ch + ']');
+        }
+    }
+
+    /**
+     * Converts primitive double to byte array.
+     *
+     * @param d Double to convert.
+     * @return Byte array.
+     */
+    public static byte[] doubleToBytes(double d) {
+        return longToBytes(Double.doubleToLongBits(d));
+    }
+
+    /**
+     * Converts primitive {@code double} type to byte array and stores
+     * it in the specified byte array.
+     *
+     * @param d Double to convert.
+     * @param bytes Array of bytes.
+     * @param off Offset.
+     * @return New offset.
+     */
+    public static int doubleToBytes(double d, byte[] bytes, int off) {
+        return longToBytes(Double.doubleToLongBits(d), bytes, off);
+    }
+
+    /**
+     * Converts primitive float to byte array.
+     *
+     * @param f Float to convert.
+     * @return Array of bytes.
+     */
+    public static byte[] floatToBytes(float f) {
+        return intToBytes(Float.floatToIntBits(f));
+    }
+
+    /**
+     * Converts primitive float to byte array.
+     *
+     * @param f Float to convert.
+     * @param bytes Array of bytes.
+     * @param off Offset.
+     * @return New offset.
+     */
+    public static int floatToBytes(float f, byte[] bytes, int off) {
+        return intToBytes(Float.floatToIntBits(f), bytes, off);
+    }
+
+    /**
+     * Converts primitive {@code long} type to byte array.
+     *
+     * @param l Long value.
+     * @return Array of bytes.
+     */
+    public static byte[] longToBytes(long l) {
+        return GridClientByteUtils.longToBytes(l);
+    }
+
+    /**
+     * Converts primitive {@code long} type to byte array and stores it in specified
+     * byte array.
+     *
+     * @param l Long value.
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Number of bytes overwritten in {@code bytes} array.
+     */
+    public static int longToBytes(long l, byte[] bytes, int off) {
+        return off + GridClientByteUtils.longToBytes(l, bytes, off);
+    }
+
+    /**
+     * Converts primitive {@code int} type to byte array.
+     *
+     * @param i Integer value.
+     * @return Array of bytes.
+     */
+    public static byte[] intToBytes(int i) {
+        return GridClientByteUtils.intToBytes(i);
+    }
+
+    /**
+     * Converts primitive {@code int} type to byte array and stores it in specified
+     * byte array.
+     *
+     * @param i Integer value.
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Number of bytes overwritten in {@code bytes} array.
+     */
+    public static int intToBytes(int i, byte[] bytes, int off) {
+        return off + GridClientByteUtils.intToBytes(i, bytes, off);
+    }
+
+    /**
+     * Converts primitive {@code short} type to byte array.
+     *
+     * @param s Short value.
+     * @return Array of bytes.
+     */
+    public static byte[] shortToBytes(short s) {
+        return GridClientByteUtils.shortToBytes(s);
+    }
+
+    /**
+     * Converts primitive {@code short} type to byte array and stores it in specified
+     * byte array.
+     *
+     * @param s Short value.
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Number of bytes overwritten in {@code bytes} array.
+     */
+    public static int shortToBytes(short s, byte[] bytes, int off) {
+        return off + GridClientByteUtils.shortToBytes(s, bytes, off);
+    }
+
+    /**
+     * Encodes {@link java.util.UUID} into a sequence of bytes using the {@link java.nio.ByteBuffer},
+     * storing the result into a new byte array.
+     *
+     * @param uuid Unique identifier.
+     * @param arr Byte array to fill with result.
+     * @param off Offset in {@code arr}.
+     * @return Number of bytes overwritten in {@code bytes} array.
+     */
+    public static int uuidToBytes(@Nullable UUID uuid, byte[] arr, int off) {
+        return off + GridClientByteUtils.uuidToBytes(uuid, arr, off);
+    }
+
+    /**
+     * Converts an UUID to byte array.
+     *
+     * @param uuid UUID value.
+     * @return Encoded into byte array {@link java.util.UUID}.
+     */
+    public static byte[] uuidToBytes(@Nullable UUID uuid) {
+        return GridClientByteUtils.uuidToBytes(uuid);
+    }
+
+    /**
+     * Constructs {@code short} from byte array.
+     *
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Short value.
+     */
+    public static short bytesToShort(byte[] bytes, int off) {
+        assert bytes != null;
+
+        int bytesCnt = Short.SIZE >> 3;
+
+        if (off + bytesCnt > bytes.length)
+            // Just use the remainder.
+            bytesCnt = bytes.length - off;
+
+        short res = 0;
+
+        for (int i = 0; i < bytesCnt; i++) {
+            int shift = bytesCnt - i - 1 << 3;
+
+            res |= (0xffL & bytes[off++]) << shift;
+        }
+
+        return res;
+    }
+
+    /**
+     * Constructs {@code int} from byte array.
+     *
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Integer value.
+     */
+    public static int bytesToInt(byte[] bytes, int off) {
+        assert bytes != null;
+
+        int bytesCnt = Integer.SIZE >> 3;
+
+        if (off + bytesCnt > bytes.length)
+            // Just use the remainder.
+            bytesCnt = bytes.length - off;
+
+        int res = 0;
+
+        for (int i = 0; i < bytesCnt; i++) {
+            int shift = bytesCnt - i - 1 << 3;
+
+            res |= (0xffL & bytes[off++]) << shift;
+        }
+
+        return res;
+    }
+
+    /**
+     * Constructs {@code long} from byte array.
+     *
+     * @param bytes Array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return Long value.
+     */
+    public static long bytesToLong(byte[] bytes, int off) {
+        assert bytes != null;
+
+        int bytesCnt = Long.SIZE >> 3;
+
+        if (off + bytesCnt > bytes.length)
+            bytesCnt = bytes.length - off;
+
+        long res = 0;
+
+        for (int i = 0; i < bytesCnt; i++) {
+            int shift = bytesCnt - i - 1 << 3;
+
+            res |= (0xffL & bytes[off++]) << shift;
+        }
+
+        return res;
+    }
+
+    /**
+     * Reads an {@link java.util.UUID} form byte array.
+     * If given array contains all 0s then {@code null} will be returned.
+     *
+     * @param bytes array of bytes.
+     * @param off Offset in {@code bytes} array.
+     * @return UUID value or {@code null}.
+     */
+    public static UUID bytesToUuid(byte[] bytes, int off) {
+        return GridClientByteUtils.bytesToUuid(bytes, off);
+    }
+
+    /**
+     * Constructs double from byte array.
+     *
+     * @param bytes Byte array.
+     * @param off Offset in {@code bytes} array.
+     * @return Double value.
+     */
+    public static double bytesToDouble(byte[] bytes, int off) {
+        return Double.longBitsToDouble(bytesToLong(bytes, off));
+    }
+
+    /**
+     * Constructs float from byte array.
+     *
+     * @param bytes Byte array.
+     * @param off Offset in {@code bytes} array.
+     * @return Float value.
+     */
+    public static float bytesToFloat(byte[] bytes, int off) {
+        return Float.intBitsToFloat(bytesToInt(bytes, off));
+    }
+
+    /**
+     * Compares fragments of byte arrays.
+     *
+     * @param a First array.
+     * @param aOff First array offset.
+     * @param b Second array.
+     * @param bOff Second array offset.
+     * @param len Length of fragments.
+     * @return {@code true} if fragments are equal, {@code false} otherwise.
+     */
+    public static boolean bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len) {
+        if (aOff + len > a.length || bOff + len > b.length)
+            return false;
+        else {
+            for (int i = 0; i < len; i++)
+                if (a[aOff + i] != b[bOff + i])
+                    return false;
+
+            return true;
+        }
+    }
+
+    /**
+     * Converts an array of characters representing hexidecimal values into an
+     * array of bytes of those same values. The returned array will be half the
+     * length of the passed array, as it takes two characters to represent any
+     * given byte. An exception is thrown if the passed char array has an odd
+     * number of elements.
+     *
+     * @param data An array of characters containing hexidecimal digits
+     * @return A byte array containing binary data decoded from
+     *         the supplied char array.
+     * @throws org.apache.ignite.IgniteCheckedException Thrown if an odd number or illegal of characters is supplied.
+     */
+    public static byte[] decodeHex(char[] data) throws IgniteCheckedException {
+
+        int len = data.length;
+
+        if ((len & 0x01) != 0)
+            throw new IgniteCheckedException("Odd number of characters.");
+
+        byte[] out = new byte[len >> 1];
+
+        // Two characters form the hex value.
+        for (int i = 0, j = 0; j < len; i++) {
+            int f = toDigit(data[j], j) << 4;
+
+            j++;
+
+            f |= toDigit(data[j], j);
+
+            j++;
+
+            out[i] = (byte)(f & 0xFF);
+        }
+
+        return out;
+    }
+
+    /**
      * Verifier always returns successful result for any host.
      */
     private static class DeploymentHostnameVerifier implements HostnameVerifier {
@@ -3965,9 +4597,9 @@ public abstract class IgniteUtils {
     public static void igniteUuidToBytes(IgniteUuid uuid, byte[] out, int off) {
         assert uuid != null;
 
-        IgniteByteUtils.longToBytes(uuid.globalId().getMostSignificantBits(), out, off);
-        IgniteByteUtils.longToBytes(uuid.globalId().getLeastSignificantBits(), out, off + 8);
-        IgniteByteUtils.longToBytes(uuid.localId(), out, off + 16);
+        longToBytes(uuid.globalId().getMostSignificantBits(), out, off);
+        longToBytes(uuid.globalId().getLeastSignificantBits(), out, off + 8);
+        longToBytes(uuid.localId(), out, off + 16);
     }
 
     /**
@@ -3978,9 +4610,9 @@ public abstract class IgniteUtils {
      * @return GridUuid instance.
      */
     public static IgniteUuid bytesToIgniteUuid(byte[] in, int off) {
-        long most = IgniteByteUtils.bytesToLong(in, off);
-        long least = IgniteByteUtils.bytesToLong(in, off + 8);
-        long locId = IgniteByteUtils.bytesToLong(in, off + 16);
+        long most = bytesToLong(in, off);
+        long least = bytesToLong(in, off + 8);
+        long locId = bytesToLong(in, off + 16);
 
         return new IgniteUuid(IgniteUuidCache.onIgniteUuidRead(new UUID(most, least)), locId);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridConnectionBytesVerifyFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridConnectionBytesVerifyFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridConnectionBytesVerifyFilter.java
index a01683d..2ebc27f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridConnectionBytesVerifyFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridConnectionBytesVerifyFilter.java
@@ -105,7 +105,7 @@ public class GridConnectionBytesVerifyFilter extends GridNioFilterAdapter {
                 ses.addMeta(MAGIC_META_KEY, cnt + magicRead);
                 ses.addMeta(MAGIC_BUF_KEY, magicBuf);
             }
-            else if (IgniteByteUtils.bytesEqual(magicBuf, 0, U.IGNITE_HEADER, 0, U.IGNITE_HEADER.length)) {
+            else if (U.bytesEqual(magicBuf, 0, U.IGNITE_HEADER, 0, U.IGNITE_HEADER.length)) {
                 // Magic bytes read and equal to IGNITE_HEADER.
                 ses.removeMeta(MAGIC_BUF_KEY);
                 ses.addMeta(MAGIC_META_KEY, U.IGNITE_HEADER.length);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
index b529929..bb38107 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
@@ -521,7 +521,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient
             assert off == 0;
             assert resBuf.length >= resOff + len + 4;
 
-            IgniteByteUtils.intToBytes(len, resBuf, resOff);
+            U.intToBytes(len, resBuf, resOff);
 
             U.arrayCopy(b, off, resBuf, resOff + 4, len);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index e8951a1..d674182 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -25,7 +25,6 @@ import org.apache.ignite.cache.eviction.random.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.processors.igfs.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.event.*;
@@ -43,6 +42,7 @@ import java.nio.file.*;
 import java.text.*;
 import java.util.*;
 import java.util.concurrent.atomic.*;
+import java.util.zip.*;
 
 import static java.lang.System.*;
 import static org.apache.ignite.configuration.IgfsConfiguration.*;
@@ -576,7 +576,7 @@ public class VisorTaskUtils {
 
                 boolean zipped = buf.length > 512;
 
-                return new VisorFileBlock(file.getPath(), pos, fSz, fLastModified, zipped, zipped ? IgniteByteUtils.zipBytes(buf) : buf);
+                return new VisorFileBlock(file.getPath(), pos, fSz, fLastModified, zipped, zipped ? zipBytes(buf) : buf);
             }
         }
         finally {
@@ -803,4 +803,43 @@ public class VisorTaskUtils {
 
         return pb.start();
     }
+
+    /**
+     * Zips byte array.
+     *
+     * @param input Input bytes.
+     * @return Zipped byte array.
+     * @throws java.io.IOException If failed.
+     */
+    public static byte[] zipBytes(byte[] input) throws IOException {
+        return zipBytes(input, 4096);
+    }
+
+    /**
+     * Zips byte array.
+     *
+     * @param input Input bytes.
+     * @param initBufSize Initial buffer size.
+     * @return Zipped byte array.
+     * @throws java.io.IOException If failed.
+     */
+    public static byte[] zipBytes(byte[] input, int initBufSize) throws IOException {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream(initBufSize);
+
+        try (ZipOutputStream zos = new ZipOutputStream(bos)) {
+            ZipEntry entry = new ZipEntry("");
+
+            try {
+                entry.setSize(input.length);
+
+                zos.putNextEntry(entry);
+
+                zos.write(input);
+            } finally {
+                zos.closeEntry();
+            }
+        }
+
+        return bos.toByteArray();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java
index 22e08f8..5668622 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java
@@ -221,7 +221,7 @@ public class IgniteProductVersion implements Comparable<IgniteProductVersion>, E
         out.writeByte(minor);
         out.writeByte(maintenance);
         out.writeLong(revTs);
-        IgniteByteUtils.writeByteArray(out, revHash);
+        U.writeByteArray(out, revHash);
     }
 
     /** {@inheritDoc} */
@@ -230,7 +230,7 @@ public class IgniteProductVersion implements Comparable<IgniteProductVersion>, E
         minor = in.readByte();
         maintenance = in.readByte();
         revTs = in.readLong();
-        revHash = IgniteByteUtils.readByteArray(in);
+        revHash = U.readByteArray(in);
     }
 
     /** {@inheritDoc} */
@@ -278,7 +278,7 @@ public class IgniteProductVersion implements Comparable<IgniteProductVersion>, E
                 byte[] revHash = null;
 
                 if (match.group(9) != null)
-                    revHash = IgniteByteUtils.decodeHex(match.group(10).toCharArray());
+                    revHash = U.decodeHex(match.group(10).toCharArray());
 
                 return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 1002d3f..eacd742 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -305,7 +305,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     assert ses.accepted();
 
                     if (msg instanceof NodeIdMessage)
-                        sndId = IgniteByteUtils.bytesToUuid(((NodeIdMessage) msg).nodeIdBytes, 0);
+                        sndId = U.bytesToUuid(((NodeIdMessage) msg).nodeIdBytes, 0);
                     else {
                         assert msg instanceof HandshakeMessage : msg;
 
@@ -2215,7 +2215,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         i += read;
                     }
 
-                    UUID rmtNodeId0 = IgniteByteUtils.bytesToUuid(buf.array(), 1);
+                    UUID rmtNodeId0 = U.bytesToUuid(buf.array(), 1);
 
                     if (!rmtNodeId.equals(rmtNodeId0))
                         throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
@@ -2986,7 +2986,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 }
 
                 // First 4 bytes are for length.
-                UUID id = IgniteByteUtils.bytesToUuid(b, 1);
+                UUID id = U.bytesToUuid(b, 1);
 
                 if (!rmtNodeId.equals(id))
                     throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
@@ -3085,7 +3085,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
             buf.put(HANDSHAKE_MSG_TYPE);
 
-            byte[] bytes = IgniteByteUtils.uuidToBytes(nodeId);
+            byte[] bytes = U.uuidToBytes(nodeId);
 
             assert bytes.length == 16 : bytes.length;
 
@@ -3107,7 +3107,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
             buf.get(nodeIdBytes);
 
-            nodeId = IgniteByteUtils.bytesToUuid(nodeIdBytes, 0);
+            nodeId = U.bytesToUuid(nodeIdBytes, 0);
 
             rcvCnt = buf.getLong();
 
@@ -3225,7 +3225,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          * @param nodeId Node ID.
          */
         private NodeIdMessage(UUID nodeId) {
-            nodeIdBytes = IgniteByteUtils.uuidToBytes(nodeId);
+            nodeIdBytes = U.uuidToBytes(nodeId);
 
             nodeIdBytesWithType = new byte[nodeIdBytes.length + 1];
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 62ddfbb..59336ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -4601,7 +4601,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                         }
                     }
 
-                    if (!IgniteByteUtils.bytesEqual(buf, 0, U.IGNITE_HEADER, 0, 4)) {
+                    if (!U.bytesEqual(buf, 0, U.IGNITE_HEADER, 0, 4)) {
                         if (log.isDebugEnabled())
                             log.debug("Unknown connection detected (is some other software connecting to " +
                                 "this Ignite port?) " +

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index 9ea562a..0265b15 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -402,7 +402,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
             ClusterMetricsSnapshot.serialize(mtr, 0, metrics);
         }
 
-        IgniteByteUtils.writeByteArray(out, mtr);
+        U.writeByteArray(out, mtr);
 
         out.writeLong(order);
         out.writeLong(intOrder);
@@ -423,7 +423,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
 
         consistentId = U.consistentId(addrs, discPort);
 
-        byte[] mtr = IgniteByteUtils.readByteArray(in);
+        byte[] mtr = U.readByteArray(in);
 
         if (mtr != null)
             metrics = ClusterMetricsSnapshot.deserialize(mtr, 0);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index 49924e4..23e9e43 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -438,7 +438,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
 
                             byte[] data = resPckt.getData();
 
-                            if (!IgniteByteUtils.bytesEqual(U.IGNITE_HEADER, 0, data, 0, U.IGNITE_HEADER.length)) {
+                            if (!U.bytesEqual(U.IGNITE_HEADER, 0, data, 0, U.IGNITE_HEADER.length)) {
                                 U.error(log, "Failed to verify message header.");
 
                                 continue;
@@ -558,7 +558,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
          * @throws IgniteCheckedException If unmarshalling failed.
          */
         private AddressResponse(byte[] data) throws IgniteCheckedException {
-            assert IgniteByteUtils.bytesEqual(U.IGNITE_HEADER, 0, data, 0, U.IGNITE_HEADER.length);
+            assert U.bytesEqual(U.IGNITE_HEADER, 0, data, 0, U.IGNITE_HEADER.length);
 
             this.data = data;
 
@@ -706,7 +706,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
 
                     sock.receive(pckt);
 
-                    if (!IgniteByteUtils.bytesEqual(U.IGNITE_HEADER, 0, reqData, 0, U.IGNITE_HEADER.length)) {
+                    if (!U.bytesEqual(U.IGNITE_HEADER, 0, reqData, 0, U.IGNITE_HEADER.length)) {
                         U.error(log, "Failed to verify message header.");
 
                         continue;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
index a2aa024..2f4986e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
@@ -64,14 +64,14 @@ public class TcpDiscoveryAuthFailedMessage extends TcpDiscoveryAbstractMessage {
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
 
-        IgniteByteUtils.writeByteArray(out, addr.getAddress());
+        U.writeByteArray(out, addr.getAddress());
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         super.readExternal(in);
 
-        addr = InetAddress.getByAddress(IgniteByteUtils.readByteArray(in));
+        addr = InetAddress.getByAddress(U.readByteArray(in));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
index 834ccc0..66b5dd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
@@ -216,8 +216,8 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
 
         byte[] buf = new byte[16 + ClusterMetricsSnapshot.METRICS_SIZE];
 
-        IgniteByteUtils.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
-        IgniteByteUtils.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
+        U.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
+        U.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
 
         ClusterMetricsSnapshot.serialize(buf, 16, metrics);
 
@@ -265,7 +265,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
         public Collection<T2<UUID, ClusterMetrics>> clientMetrics() {
             return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, ClusterMetrics>>() {
                 @Override public T2<UUID, ClusterMetrics> apply(byte[] bytes) {
-                    UUID nodeId = new UUID(IgniteByteUtils.bytesToLong(bytes, 0), IgniteByteUtils.bytesToLong(bytes, 8));
+                    UUID nodeId = new UUID(U.bytesToLong(bytes, 0), U.bytesToLong(bytes, 8));
 
                     return new T2<>(nodeId, ClusterMetricsSnapshot.deserialize(bytes, 16));
                 }
@@ -288,19 +288,19 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
 
         /** {@inheritDoc} */
         @Override public void writeExternal(ObjectOutput out) throws IOException {
-            IgniteByteUtils.writeByteArray(out, metrics);
+            U.writeByteArray(out, metrics);
 
             out.writeInt(clientMetrics != null ? clientMetrics.size() : -1);
 
             if (clientMetrics != null) {
                 for (byte[] arr : clientMetrics)
-                    IgniteByteUtils.writeByteArray(out, arr);
+                    U.writeByteArray(out, arr);
             }
         }
 
         /** {@inheritDoc} */
         @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            metrics = IgniteByteUtils.readByteArray(in);
+            metrics = U.readByteArray(in);
 
             int clientMetricsSize = in.readInt();
 
@@ -308,7 +308,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
                 clientMetrics = new ArrayList<>(clientMetricsSize);
 
                 for (int i = 0; i < clientMetricsSize; i++)
-                    clientMetrics.add(IgniteByteUtils.readByteArray(in));
+                    clientMetrics.add(U.readByteArray(in));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
index 19cbfa1..2e48648 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -284,7 +285,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
                 assert txs.isEmpty() : "Incomplete transactions: " + txs;
             }
 
-            byte[] concat = IgniteByteUtils.join(remainder, data, remainder2);
+            byte[] concat = U.join(remainder, data, remainder2);
 
             // Validate data stored in cache.
             for (int pos = 0, block = 0; pos < info.length(); block++) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 5436c59..8f7796d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -121,7 +121,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
      */
     public void testByteArray2String() throws Exception {
         assertEquals("{0x0A,0x14,0x1E,0x28,0x32,0x3C,0x46,0x50,0x5A}",
-            IgniteByteUtils.byteArray2String(new byte[]{10, 20, 30, 40, 50, 60, 70, 80, 90}, "0x%02X", ",0x%02X"));
+            U.byteArray2String(new byte[]{10, 20, 30, 40, 50, 60, 70, 80, 90}, "0x%02X", ",0x%02X"));
     }
 
     /**
@@ -474,7 +474,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < 100; i++) {
             UUID id = UUID.randomUUID();
 
-            byte[] bytes = IgniteByteUtils.uuidToBytes(id);
+            byte[] bytes = U.uuidToBytes(id);
             BigInteger n = new BigInteger(bytes);
 
             assert n.shiftRight(Long.SIZE).longValue() == id.getMostSignificantBits();
@@ -487,8 +487,8 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings("ZeroLengthArrayAllocation")
     public void testReadByteArray() {
-        assertTrue(Arrays.equals(new byte[0], IgniteByteUtils.readByteArray(ByteBuffer.allocate(0))));
-        assertTrue(Arrays.equals(new byte[0], IgniteByteUtils.readByteArray(ByteBuffer.allocate(0), ByteBuffer.allocate(0))));
+        assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0))));
+        assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.allocate(0))));
 
         Random rnd = new Random();
 
@@ -496,9 +496,9 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
 
         rnd.nextBytes(bytes);
 
-        assertTrue(Arrays.equals(bytes, IgniteByteUtils.readByteArray(ByteBuffer.wrap(bytes))));
-        assertTrue(Arrays.equals(bytes, IgniteByteUtils.readByteArray(ByteBuffer.wrap(bytes), ByteBuffer.allocate(0))));
-        assertTrue(Arrays.equals(bytes, IgniteByteUtils.readByteArray(ByteBuffer.allocate(0), ByteBuffer.wrap(bytes))));
+        assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes))));
+        assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes), ByteBuffer.allocate(0))));
+        assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.wrap(bytes))));
 
         for (int i = 0; i < 1000; i++) {
             int n = rnd.nextInt(100);
@@ -519,7 +519,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
 
             bufs[bufs.length - 1] = (ByteBuffer)ByteBuffer.wrap(bytes).position(x).limit(n);
 
-            assertTrue(Arrays.equals(bytes, IgniteByteUtils.readByteArray(bufs)));
+            assertTrue(Arrays.equals(bytes, U.readByteArray(bufs)));
         }
     }
 
@@ -544,7 +544,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
                 bufs[j] = ByteBuffer.wrap(bytes);
             }
 
-            assertEquals(U.hashCode(bufs), Arrays.hashCode(IgniteByteUtils.readByteArray(bufs)));
+            assertEquals(U.hashCode(bufs), Arrays.hashCode(U.readByteArray(bufs)));
         }
     }
 
@@ -692,7 +692,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
 
 
     public void testMD5Calculation() throws Exception {
-        String md5 = IgniteUtils.calculateMD5(new ByteArrayInputStream("Corrupted information.".getBytes()));
+        String md5 = U.calculateMD5(new ByteArrayInputStream("Corrupted information.".getBytes()));
 
         assertEquals("d7dbe555be2eee7fa658299850169fa1", md5);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
index f6157ad..83729fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
@@ -1144,7 +1144,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
     private byte[] createMessageWithSize() {
         byte[] msg = new byte[MSG_SIZE];
 
-        IgniteByteUtils.intToBytes(MSG_SIZE - 4, msg, 0);
+        U.intToBytes(MSG_SIZE - 4, msg, 0);
 
         return msg;
     }
@@ -1329,7 +1329,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
          * @throws IOException If send failed.
          */
         public void sendMessage(byte[] data, int len) throws IOException {
-            out.write(IgniteByteUtils.intToBytes(len));
+            out.write(U.intToBytes(len));
             out.write(data, 0, len);
         }
 
@@ -1353,7 +1353,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
                 idx += read;
             }
 
-            int len = IgniteByteUtils.bytesToInt(prefix, 0);
+            int len = U.bytesToInt(prefix, 0);
 
             byte[] res = new byte[len];
             idx = 0;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridRoundTripTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridRoundTripTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridRoundTripTest.java
index 69efd29..bffbfc7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridRoundTripTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridRoundTripTest.java
@@ -181,7 +181,7 @@ public class GridRoundTripTest extends TestCase {
             tmp.write(symbol);
         }
 
-        int length = IgniteByteUtils.bytesToInt(tmp.toByteArray(), 0);
+        int length = U.bytesToInt(tmp.toByteArray(), 0);
 
         tmp.reset();
 
@@ -206,7 +206,7 @@ public class GridRoundTripTest extends TestCase {
      * @throws IOException If error occurs.
      */
     private static void writeMessage(OutputStream out, byte[] msg) throws IOException {
-        out.write(IgniteByteUtils.intToBytes(msg.length));
+        out.write(U.intToBytes(msg.length));
         out.write(msg);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
index d59282c..5512bfd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.offheap.unsafe.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.jdk8.backport.*;
@@ -699,7 +700,7 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
                         int valSize = rnd.nextInt(50) + 1;
 
                         for (int i = 0; i < size; i++)
-                            map.put(i, IgniteByteUtils.intToBytes(i), new byte[valSize]);
+                            map.put(i, U.intToBytes(i), new byte[valSize]);
                     }
                 }
                 catch (InterruptedException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/lang/GridByteArrayListSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridByteArrayListSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/GridByteArrayListSelfTest.java
index 25396b9..c4c3280 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/GridByteArrayListSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/GridByteArrayListSelfTest.java
@@ -91,7 +91,7 @@ public class GridByteArrayListSelfTest extends GridCommonAbstractTest {
 
         assert list.size() == 4;
 
-        assert Arrays.equals(list.array(), IgniteByteUtils.intToBytes(num));
+        assert Arrays.equals(list.array(), U.intToBytes(num));
 
         int num2 = 2;
 
@@ -105,8 +105,8 @@ public class GridByteArrayListSelfTest extends GridCommonAbstractTest {
 
         byte[] arr2 = new byte[8];
 
-        U.arrayCopy(IgniteByteUtils.intToBytes(num), 0, arr2, 0, 4);
-        U.arrayCopy(IgniteByteUtils.intToBytes(num3), 0, arr2, 4, 4);
+        U.arrayCopy(U.intToBytes(num), 0, arr2, 0, 4);
+        U.arrayCopy(U.intToBytes(num3), 0, arr2, 4, 4);
 
         assert Arrays.equals(list.array(), arr2);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
index 9fd952f..22ee3c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.loadtests.communication;
 
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.extensions.communication.*;
@@ -96,7 +95,7 @@ class GridTestMessage implements Message, Externalizable {
         out.writeLong(field1);
         out.writeLong(field2);
         U.writeString(out, str);
-        IgniteByteUtils.writeByteArray(out, bytes);
+        U.writeByteArray(out, bytes);
     }
 
     /** {@inheritDoc} */
@@ -105,7 +104,7 @@ class GridTestMessage implements Message, Externalizable {
         field1 = in.readLong();
         field2 = in.readLong();
         str = U.readString(in);
-        bytes = IgniteByteUtils.readByteArray(in);
+        bytes = U.readByteArray(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/core/src/test/java/org/apache/ignite/spi/swapspace/file/GridFileSwapSpaceSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/file/GridFileSwapSpaceSpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/file/GridFileSwapSpaceSpiSelfTest.java
index 598c278..104cf77 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/file/GridFileSwapSpaceSpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/file/GridFileSwapSpaceSpiSelfTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.spi.swapspace.file;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.*;
 import org.apache.ignite.spi.swapspace.*;
@@ -103,7 +104,7 @@ public class GridFileSwapSpaceSpiSelfTest extends GridSwapSpaceSpiAbstractSelfTe
      * @return Swap key.
      */
     private SwapKey key(int i) {
-        return new SwapKey(i, i % 11, IgniteByteUtils.intToBytes(i));
+        return new SwapKey(i, i % 11, U.intToBytes(i));
     }
 
     /**
@@ -339,7 +340,7 @@ public class GridFileSwapSpaceSpiSelfTest extends GridSwapSpaceSpiAbstractSelfTe
         while (iter.hasNext()) {
             Map.Entry<byte[], byte[]> entry = iter.next();
 
-            hash1 += IgniteByteUtils.bytesToInt(entry.getKey(), 0) * Arrays.hashCode(entry.getValue());
+            hash1 += U.bytesToInt(entry.getKey(), 0) * Arrays.hashCode(entry.getValue());
 
             cnt++;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/hadoop/src/main/java/org/apache/ignite/internal/igfs/hadoop/IgfsHadoopIpcIo.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/igfs/hadoop/IgfsHadoopIpcIo.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/igfs/hadoop/IgfsHadoopIpcIo.java
index e159c9d..d07f34d 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/igfs/hadoop/IgfsHadoopIpcIo.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/igfs/hadoop/IgfsHadoopIpcIo.java
@@ -397,8 +397,8 @@ public class IgfsHadoopIpcIo implements IgfsHadoopIo {
 
             byte[] hdr = IgfsMarshaller.createHeader(-1, IgfsIpcCommand.WRITE_BLOCK);
 
-            IgniteByteUtils.longToBytes(req.streamId(), hdr, 12);
-            IgniteByteUtils.intToBytes(req.length(), hdr, 20);
+            U.longToBytes(req.streamId(), hdr, 12);
+            U.intToBytes(req.length(), hdr, 20);
 
             synchronized (this) {
                 out.write(hdr);
@@ -479,7 +479,7 @@ public class IgfsHadoopIpcIo implements IgfsHadoopIo {
                 while (!Thread.currentThread().isInterrupted()) {
                     dis.readFully(hdr);
 
-                    long reqId = IgniteByteUtils.bytesToLong(hdr, 0);
+                    long reqId = U.bytesToLong(hdr, 0);
 
                     // We don't wait for write responses, therefore reqId is -1.
                     if (reqId == -1) {
@@ -513,7 +513,7 @@ public class IgfsHadoopIpcIo implements IgfsHadoopIo {
                         }
                         else {
                             try {
-                                IgfsIpcCommand cmd = IgfsIpcCommand.valueOf(IgniteByteUtils.bytesToInt(hdr, 8));
+                                IgfsIpcCommand cmd = IgfsIpcCommand.valueOf(U.bytesToInt(hdr, 8));
 
                                 if (log.isDebugEnabled())
                                     log.debug("Received IGFS response [reqId=" + reqId + ", cmd=" + cmd + ']');
@@ -534,7 +534,7 @@ public class IgfsHadoopIpcIo implements IgfsHadoopIo {
                                         IgfsControlResponse.throwError(errCode, errMsg);
                                     }
 
-                                    int blockLen = IgniteByteUtils.bytesToInt(msgHdr, 5);
+                                    int blockLen = U.bytesToInt(msgHdr, 5);
 
                                     int readLen = Math.min(blockLen, fut.outputLength());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/GridHadoopShuffleMessage.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/GridHadoopShuffleMessage.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/GridHadoopShuffleMessage.java
index 8b25836..24ebc0c 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/GridHadoopShuffleMessage.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/GridHadoopShuffleMessage.java
@@ -202,7 +202,7 @@ public class GridHadoopShuffleMessage implements GridHadoopMessage {
         out.writeLong(msgId);
         out.writeInt(reducer);
         out.writeInt(off);
-        IgniteByteUtils.writeByteArray(out, buf);
+        U.writeByteArray(out, buf);
     }
 
     /** {@inheritDoc} */
@@ -213,7 +213,7 @@ public class GridHadoopShuffleMessage implements GridHadoopMessage {
         msgId = in.readLong();
         reducer = in.readInt();
         off = in.readInt();
-        buf = IgniteByteUtils.readByteArray(in);
+        buf = U.readByteArray(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/GridHadoopSplitWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/GridHadoopSplitWrapper.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/GridHadoopSplitWrapper.java
index 4129e58..791f90b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/GridHadoopSplitWrapper.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/GridHadoopSplitWrapper.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.internal.processors.hadoop.v2;
 
 import org.apache.ignite.internal.processors.hadoop.*;
-import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 
 import java.io.*;
 
@@ -73,7 +73,7 @@ public class GridHadoopSplitWrapper extends GridHadoopInputSplit {
         out.writeInt(id);
 
         out.writeUTF(clsName);
-        IgniteByteUtils.writeByteArray(out, bytes);
+        U.writeByteArray(out, bytes);
     }
 
     /**
@@ -96,7 +96,7 @@ public class GridHadoopSplitWrapper extends GridHadoopInputSplit {
         id = in.readInt();
 
         clsName = in.readUTF();
-        bytes = IgniteByteUtils.readByteArray(in);
+        bytes = U.readByteArray(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a69903e/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 5a0a0f2..d0917f3 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -476,7 +476,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
         try {
             if (sesTokStr != null)
-                restReq.sessionToken(IgniteByteUtils.hexString2ByteArray(sesTokStr));
+                restReq.sessionToken(U.hexString2ByteArray(sesTokStr));
         }
         catch (IllegalArgumentException ignored) {
             // Ignore invalid session token.


Mime
View raw message