public static void encode(InputStream src, OutputStream dst) {
        int bytePosition;
        byte[] bytesRead = new byte[8192];
        byte[] bytesToWrite = new byte[8192];
        byte[] alphabet = getBytesAlphabet();
        int numberOfBytesRead;

        try {
            while ((numberOfBytesRead = src.read(bytesRead)) != -1) {
                for (int i = 0; i < numberOfBytesRead; i++) {
                    bytePosition = findBytePosition(bytesRead[i], alphabet);
                    bytesToWrite[i] = (byte) bytePosition;
                    moveByteToFirstPos(alphabet, bytePosition);
                }
                dst.write(bytesToWrite, 0, numberOfBytesRead);
            }
            dst.close();
        } catch (IOException e) {
            System.err.println("An error happened while encoding.");
            e.printStackTrace();
        }
    }