tikhomirov@320: /* tikhomirov@320: * Copyright (c) 2011 TMate Software Ltd tikhomirov@320: * tikhomirov@320: * This program is free software; you can redistribute it and/or modify tikhomirov@320: * it under the terms of the GNU General Public License as published by tikhomirov@320: * the Free Software Foundation; version 2 of the License. tikhomirov@320: * tikhomirov@320: * This program is distributed in the hope that it will be useful, tikhomirov@320: * but WITHOUT ANY WARRANTY; without even the implied warranty of tikhomirov@320: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tikhomirov@320: * GNU General Public License for more details. tikhomirov@320: * tikhomirov@320: * For information on how to redistribute this software under tikhomirov@320: * the terms of a license other than GNU General Public License tikhomirov@320: * contact TMate Software at support@hg4j.com tikhomirov@320: */ tikhomirov@320: package org.tmatesoft.hg.internal; tikhomirov@320: tikhomirov@320: import java.io.UnsupportedEncodingException; tikhomirov@320: tikhomirov@320: import org.tmatesoft.hg.core.HgBadStateException; tikhomirov@320: tikhomirov@320: /** tikhomirov@320: * Keep all encoding-related issues in the single place tikhomirov@320: * @author Artem Tikhomirov tikhomirov@320: * @author TMate Software Ltd. tikhomirov@320: */ tikhomirov@320: public class EncodingHelper { tikhomirov@320: // XXX perhaps, shall not be full of statics, but rather an instance coming from e.g. HgRepository? tikhomirov@320: tikhomirov@320: public static String fromManifest(byte[] data, int start, int length) { tikhomirov@320: try { tikhomirov@320: return new String(data, start, length, "ISO-8859-1"); tikhomirov@320: } catch (UnsupportedEncodingException ex) { tikhomirov@320: // can't happen tikhomirov@320: throw new HgBadStateException(ex); tikhomirov@320: } tikhomirov@320: } tikhomirov@320: }