Java tutorial
//package com.java2s; /* * Created on 7 Jun 2007 * Created by Allan Crooks * Copyright (C) 2007 Aelitis, All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * AELITIS, SAS au capital de 46,603.30 euros * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France. */ public class Main { public static boolean isAzStyle(String peer_id) { if (peer_id.charAt(0) != '-') { return false; } if (peer_id.charAt(7) == '-') { return true; } /** * Hack for FlashGet - it doesn't use the trailing dash. * Also, LH-ABC has strayed into "forgetting about the delimiter" territory. * * In fact, the code to generate a peer ID for LH-ABC is based on BitTornado's, * yet tries to give an Az style peer ID... oh dear. * * BT Next Evolution seems to be in the same boat as well. * * KTorrent 3 appears to use a dash rather than a final character. */ if (peer_id.substring(1, 3).equals("FG")) { return true; } if (peer_id.substring(1, 3).equals("LH")) { return true; } if (peer_id.substring(1, 3).equals("NE")) { return true; } if (peer_id.substring(1, 3).equals("KT")) { return true; } if (peer_id.substring(1, 3).equals("SP")) { return true; } return false; } }