/** * Converts the bytes into a String, based on the equivalent character encoding * to the supplied codepage number. * @param string The byte of the string to convert * @param codepage The codepage number */ public static String getStringFromCodePage(final byte[] string, final int codepage) throws UnsupportedEncodingException { return getStringFromCodePage(string, 0, string.length, codepage); }
protected static String getString(byte[] data, CodepageRecord codepage) { int cp = Property.DEFAULT_CODEPAGE; if (codepage != null) { cp = codepage.getCodepage() & 0xffff; } try { return CodePageUtil.getStringFromCodePage(data, cp); } catch (UnsupportedEncodingException uee) { throw new IllegalArgumentException("Unsupported codepage requested", uee); } }
public String getJavaValue( int codepage ) throws UnsupportedEncodingException { int cp = ( codepage == -1 ) ? Property.DEFAULT_CODEPAGE : codepage; String result = CodePageUtil.getStringFromCodePage(_value, cp); final int terminator = result.indexOf( '\0' ); if ( terminator == -1 ) { String msg = "String terminator (\\0) for CodePageString property value not found." + "Continue without trimming and hope for the best."; LOG.log(POILogger.WARN, msg); return result; } if ( terminator != result.length() - 1 ) { String msg = "String terminator (\\0) for CodePageString property value occured before the end of string. "+ "Trimming and hope for the best."; LOG.log(POILogger.WARN, msg ); } return result.substring( 0, terminator ); }
return CodePageUtil.getStringFromCodePage(b, Property.DEFAULT_CODEPAGE); } catch (UnsupportedEncodingException e) {
byte buf[] = IOUtils.safelyAllocate(nrBytes, MAX_RECORD_LENGTH); leis.readFully(buf, 0, nrBytes); final String str = CodePageUtil.getStringFromCodePage(buf, 0, nrBytes, cp);
/** * Converts the bytes into a String, based on the equivalent character encoding * to the supplied codepage number. * @param string The byte of the string to convert * @param codepage The codepage number */ public static String getStringFromCodePage(final byte[] string, final int codepage) throws UnsupportedEncodingException { return getStringFromCodePage(string, 0, string.length, codepage); }
protected static String getString(byte[] data, CodepageRecord codepage) { int cp = Property.DEFAULT_CODEPAGE; if (codepage != null) { cp = codepage.getCodepage() & 0xffff; } try { return CodePageUtil.getStringFromCodePage(data, cp); } catch (UnsupportedEncodingException uee) { throw new IllegalArgumentException("Unsupported codepage requested", uee); } }
public String getJavaValue( int codepage ) throws UnsupportedEncodingException { int cp = ( codepage == -1 ) ? Property.DEFAULT_CODEPAGE : codepage; String result = CodePageUtil.getStringFromCodePage(_value, cp); final int terminator = result.indexOf( '\0' ); if ( terminator == -1 ) { String msg = "String terminator (\\0) for CodePageString property value not found." + "Continue without trimming and hope for the best."; LOG.log(POILogger.WARN, msg); return result; } if ( terminator != result.length() - 1 ) { String msg = "String terminator (\\0) for CodePageString property value occured before the end of string. "+ "Trimming and hope for the best."; LOG.log(POILogger.WARN, msg ); } return result.substring( 0, terminator ); }
return CodePageUtil.getStringFromCodePage(b, Property.DEFAULT_CODEPAGE); } catch (UnsupportedEncodingException e) {
byte buf[] = IOUtils.safelyAllocate(nrBytes, MAX_RECORD_LENGTH); leis.readFully(buf, 0, nrBytes); final String str = CodePageUtil.getStringFromCodePage(buf, 0, nrBytes, cp);