Here you can find the source of asBytes(String basicString)
Parameter | Description |
---|---|
basicString | the basic PDF string, as offered by PDFObject#getStringValue() |
public static byte[] asBytes(String basicString)
//package com.java2s; /*/*from www. ja v a 2 s . c o m*/ * Copyright 2008 Pirion Systems Pty Ltd, 139 Warry St, * Fortitude Valley, Queensland, Australia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ public class Main { /** * Get the corresponding byte array for a basic string. This is effectively * the char[] array cast to bytes[], as chars in basic strings only use the * least significant byte. * * @param basicString the basic PDF string, as offered by {@link * PDFObject#getStringValue()} * @return the bytes corresponding to its characters */ public static byte[] asBytes(String basicString) { final byte[] b = new byte[basicString.length()]; for (int i = 0; i < b.length; ++i) { b[i] = (byte) basicString.charAt(i); } return b; } }