Java Byte Array Create toByteArrayNoConversion(String textz)

Here you can find the source of toByteArrayNoConversion(String textz)

Description

converts the specified string to an array of bytes (useful as Sleep stores byte arrays to strings)

License

Artistic License

Declaration

public static byte[] toByteArrayNoConversion(String textz) 

Method Source Code

//package com.java2s;
/*/*w ww. j a v a  2s  .com*/
   SLEEP - Simple Language for Environment Extension Purposes
 .-------------------------------.
 | sleep.bridges.BridgeUtilities |____________________________________________
 |                                                                            |
   Author: Raphael Mudge (raffi@hick.org)
   http://www.hick.org/~raffi/
    
   Description:
   utilities for bridge writers
    
   Documentation:
    
   Changelog:
    
   * This software is distributed under the artistic license, see license.txt
 for more information. *
    
 |____________________________________________________________________________|
 */

public class Main {
    /** converts the specified string to an array of bytes (useful as Sleep stores byte arrays to strings) */
    public static byte[] toByteArrayNoConversion(String textz) {
        byte[] data = new byte[textz.length()];

        for (int y = 0; y < data.length; y++) {
            data[y] = (byte) textz.charAt(y);
        }

        return data;
    }
}

Related

  1. toByteArrayForPBE(char[] chars)
  2. toByteArrayFromPositiveInts(int[] inInts)
  3. toByteArrayFromString(String value, int radix)
  4. toByteArrayLE(int value)
  5. toByteArrayMM(int value)
  6. toByteArrays(String s)
  7. toByteArrayShifted(int... arguments)
  8. toByteArrayShifted2(int[][] intArray)
  9. ToByteArrayString(byte[] bytes)