Java String to Byte Array getBytes(String str)

Here you can find the source of getBytes(String str)

Description

get Bytes

License

Open Source License

Declaration

private static byte[] getBytes(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;
import java.io.*;

public class Main {
    private static byte[] getBytes(String str) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        StringTokenizer st = new StringTokenizer(str, "-", false);
        while (st.hasMoreTokens()) {
            int i = Integer.parseInt(st.nextToken());
            bos.write((byte) i);
        }//  www .  ja  v  a 2  s.  c  om
        return bos.toByteArray();
    }
}

Related

  1. getBytes(String s, String charsetName)
  2. getBytes(String s, String encoding)
  3. getBytes(String s, String encoding)
  4. getBytes(String str)
  5. getBytes(String str)
  6. getBytes(String str)
  7. getBytes(String str)
  8. getBytes(String str)
  9. getBytes(String str)