• R/O
  • SSH
  • HTTPS

cabos:


File Info

Rev. 20
Tamanho 30,828 bytes
Hora 2008-09-27 18:20:45
Autor heavy_baby
Mensagem de Log

move

Content

Index: phex/tools/Ip2CountryDBBuilder.java
===================================================================
--- phex/tools/Ip2CountryDBBuilder.java	(revision 4098)
+++ phex/tools/Ip2CountryDBBuilder.java	(working copy)
@@ -2,6 +2,9 @@
  *  PHEX - The pure-java Gnutella-servent.
  *  Copyright (C) 2001 - 2006 Phex Development Group
  *
+ *  Modified by (c) 2004-2007 heavy_baby
+ *  heavy_baby@users.sourceforge.jp
+ *
  *  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
@@ -38,7 +41,8 @@
     private static final String ARIN = "ftp://ftp.apnic.net/pub/stats/arin/delegated-arin-latest";
     private static final String LACNIC = "ftp://ftp.apnic.net/pub/stats/lacnic/delegated-lacnic-latest";
     
-    private static List<IpCountryRange> dataList;
+//    private static List<IpCountryRange> dataList;
+    private static List dataList;
     
     public static void main( String args[] )
         throws Exception
@@ -46,7 +50,8 @@
         //System.setProperty( "ftp.proxyHost", "10.127.100.68" );
         //System.setProperty( "ftp.proxyPort", "8080" );
         
-        dataList = new ArrayList<IpCountryRange>();
+//        dataList = new ArrayList<IpCountryRange>();
+        dataList = new ArrayList();
         
         String[] rirs = {LACNIC, APNIC, RIPE, ARIN };
         for ( int i = 0; i < rirs.length; i++ )
@@ -74,11 +79,14 @@
     private static void writeToOutputFile( String fileName ) throws IOException
     {
         // write to output file
-        BufferedWriter writer = new BufferedWriter( new FileWriter( "src/phex/resources/" + fileName ) );
-        Iterator<IpCountryRange> iterator = dataList.iterator();
+//        BufferedWriter writer = new BufferedWriter( new FileWriter( "src/phex/resources/" + fileName ) );
+        BufferedWriter writer = new BufferedWriter( new FileWriter( fileName ) );
+//        Iterator<IpCountryRange> iterator = dataList.iterator();
+        Iterator iterator = dataList.iterator();
         while ( iterator.hasNext() )
         {
-            IpCountryRange range = iterator.next();
+//            IpCountryRange range = iterator.next();
+            IpCountryRange range = (IpCountryRange)iterator.next();
             //writer.write( "\"" + range.from + "\",\"" + range.to + "\",\""
             //    + range.countryCode + "\"\n" );
             writer.write( "" + range.from + "," + range.to + ","
@@ -89,15 +97,18 @@
     
     private static void consolidateList()
     {
-        List<IpCountryRange> consolidatedList = new ArrayList<IpCountryRange>();
+//        List<IpCountryRange> consolidatedList = new ArrayList<IpCountryRange>();
+        List consolidatedList = new ArrayList();
         int size = dataList.size();
         for ( int i = 0; i < size; i++ )
         {
-            IpCountryRange range = dataList.get( i );
+//            IpCountryRange range = dataList.get( i );
+            IpCountryRange range = (IpCountryRange)dataList.get( i );
 //System.out.println( "range: " + range );            
             for ( int j = i+1; j < size; j++ )
             {
-                IpCountryRange nextRange = dataList.get( j );
+//                IpCountryRange nextRange = dataList.get( j );
+                IpCountryRange nextRange = (IpCountryRange)dataList.get( j );
 //System.out.println( "nextrange: " + nextRange );
                 if ( !range.countryCode.equals( nextRange.countryCode ) )
                 {
@@ -143,6 +154,18 @@
             tokenizer.nextToken();
             // country
             String countryCode = tokenizer.nextToken();
+            /* cabos */
+            Locale[] locales = Locale.getAvailableLocales();
+            boolean found = false;
+            for (int i = 0; i < locales.length; i++) {
+                if (countryCode.equals(locales[i].getCountry())) {
+                    countryCode = locales[i].getLanguage();
+                    found = true;
+                    break;
+                }
+            }
+            if (!found || countryCode.equals("en")) continue;
+            
             // type 
             String type = tokenizer.nextToken();
             if ( !type.equals( "ipv4" ) )
@@ -169,7 +192,8 @@
         }
     }
     
-    private static class IpCountryRange implements Comparable<IpCountryRange>
+//    private static class IpCountryRange implements Comparable<IpCountryRange>
+    private static class IpCountryRange implements Comparable
     {
         long from;
         long to;
@@ -187,13 +211,16 @@
             return String.valueOf( from ) + " - " + String.valueOf( to ) + " " + countryCode; 
         }
 
-        public int compareTo( IpCountryRange range )
+//        public int compareTo( IpCountryRange range )
+        public int compareTo( Object range )
         {
-            if ( from > range.from )
+//            if ( from > range.from )
+            if ( from > ((IpCountryRange)range).from )
             {
                 return 1;
             }
-            else if ( from < range.from )
+//            else if ( from < range.from )
+            else if ( from < ((IpCountryRange)range).from )
             {
                 return -1;
             }
Index: phex/common/address/AddressUtils.java
===================================================================
--- phex/common/address/AddressUtils.java	(revision 4098)
+++ phex/common/address/AddressUtils.java	(working copy)
@@ -2,6 +2,9 @@
  *  PHEX - The pure-java Gnutella-servent.
  *  Copyright (C) 2001 - 2007 Phex Development Group
  *
+ *  Modified by (c) 2004-2007 heavy_baby
+ *  heavy_baby@users.sourceforge.jp
+ *
  *  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
@@ -22,6 +25,7 @@
  */
 package phex.common.address;
 
+/*
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,6 +35,7 @@
 import phex.security.PhexSecurityManager;
 import phex.utils.IOUtil;
 import phex.utils.NLogger;
+*/
 
 public class AddressUtils
 {
@@ -38,6 +43,7 @@
      * Array containing the int value network mask at the possition
      * of its corresonding cidr value.
      */
+/*
     public static final int[] CIDR2MASK = new int[]
     {
         0x00000000, 0x80000000, 0xC0000000, 0xE0000000,
@@ -50,10 +56,12 @@
         0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE,
         0xFFFFFFFF
     };
+*/
     
     /**
      * Converts the given bytes of an IP to a string representation.
      */
+/*
     public static String ip2string(byte[] ip)
     {
         if ( ip == null )
@@ -67,10 +75,12 @@
             + (ip[2] & 0xff) + "." 
             + (ip[3] & 0xff);
     }
+*/
     
     /**
      * Converts the given bytes of an IP to a string representation.
      */
+/*
     public static String ip2string( int ip )
     {
         return ((ip >> 24) & 0xFF) + "." +
@@ -78,12 +88,14 @@
                ((ip >>  8) & 0xFF) + "." + 
                ( ip        & 0xFF);
     }
+*/
 
     /**
      * Returns true if the given host name represents a IP address.
      * @param hostName
      * @return true if the given host name represents a IP address.
      */
+/*
     public static boolean isIPHostName( String hostName )
     {
         int portSeparatorIdx = hostName.indexOf( ':' );
@@ -121,6 +133,7 @@
         }
         return true;
     }
+*/
 
     /**
      * Parses and validates a host address string in the format
@@ -130,6 +143,7 @@
      * @return the parsed host address or null in case ther is any kind of error.
      * @throws MalformedDestAddressException
      */
+/*
     public static DestAddress parseAndValidateAddress( String addressString,
         boolean isPrivateIpAllowed )
         throws MalformedDestAddressException
@@ -176,6 +190,7 @@
         }
         return hostAddress;
     }
+*/
 
     /**
      * Parses a unsigned int value to a byte array containing the IP
@@ -201,6 +216,7 @@
      * @param netmask
      * @return
      */
+/*
     public static int parseNetmaskToInt( String netmask )
     {
         if ( netmask.indexOf( '.' ) == -1 )
@@ -228,6 +244,7 @@
             return parseDottedIpToInt( netmask );
         }
     }
+*/
     
     /**
      * Parses a netmask. This can either be in ip format (xxx.xxx.xxx.xxx)
@@ -235,6 +252,7 @@
      * @param netmask
      * @return
      */
+/*
     public static byte parseNetmaskToCidr( String netmask )
     {
         if ( netmask.indexOf( '.' ) == -1 )
@@ -258,6 +276,7 @@
             return calculateCidr( parseDottedIpToInt( netmask ) );
         }
     }
+*/
     
     /**
      * Parses an ip in the format xxx.xxx.xxx.xxx into an int value.
@@ -347,7 +366,7 @@
         }
         catch ( IllegalArgumentException exp )
         {
-            NLogger.warn( AddressUtils.class, exp );
+//            NLogger.warn( AddressUtils.class, exp );
             return null;
         }
     }
@@ -357,6 +376,7 @@
      * returned.
      * @throws MalformedDestAddressException if port is out of range.
      */
+/*
     public static int parsePort( String hostName ) 
     {
         int portIdx = hostName.indexOf( ':' );
@@ -417,6 +437,7 @@
         addr[3] = (byte) (ip & 0xFF);
         return addr;
     }
+*/
 
     /**
      * Validates a port value if it is in range ( 1 - 65535 )
@@ -425,16 +446,19 @@
      * converted to singned int to let this function work correctly.
      * @return true if the port is in range, false otherwise.
      */
+/*
     public static boolean isPortInRange( int port )
     {
         return ( port & 0xFFFF0000 ) == 0 && port != 0;
     }
+*/
     
     /**
      * Calculates the cidr from an netmask IP.
      * @param ip
      * @return
      */
+/*
     public static byte calculateCidr( int ip )
     {
         byte b = 0;
@@ -472,12 +496,14 @@
         }
         throw new IllegalArgumentException( "Invalid byte value" );
     }
+*/
     
     /**
      * Calculates the cidr from an netmask IP.
      * @param ip
      * @return
      */
+/*
     public static byte calculateCidr( byte[] ip )
     {
         int intIp = byteIpToIntIp( ip );
@@ -514,4 +540,5 @@
         }
         return pairs;
     }
+*/
 }
\ No newline at end of file
Index: phex/common/AbstractManager.java
===================================================================
--- phex/common/AbstractManager.java	(revision 4098)
+++ phex/common/AbstractManager.java	(working copy)
@@ -36,7 +36,7 @@
 
     public abstract void shutdown();
 
-    @Override
+//    @Override
 	protected final Object clone() throws CloneNotSupportedException
     {
         throw new CloneNotSupportedException();
Index: phex/common/Ip2CountryManager.java
===================================================================
--- phex/common/Ip2CountryManager.java	(revision 4098)
+++ phex/common/Ip2CountryManager.java	(working copy)
@@ -2,6 +2,9 @@
  *  PHEX - The pure-java Gnutella-servent.
  *  Copyright (C) 2001 - 2007 Phex Development Group
  *
+ *  Modified by (c) 2004-2007 heavy_baby
+ *  heavy_baby@users.sourceforge.jp
+ *
  *  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
@@ -22,36 +25,44 @@
 package phex.common;
 
 import java.io.BufferedReader;
+/* cabos */
+import java.io.FileReader;
+import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+//import java.io.InputStream;
+//import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
 import phex.common.address.AddressUtils;
-import phex.common.address.IpAddress;
+//import phex.common.address.IpAddress;
 import phex.utils.IOUtil;
-import phex.utils.NLogger;
-import phex.utils.NLoggerNames;
+//import phex.utils.NLogger;
+//import phex.utils.NLoggerNames;
 
 /**
  * 
  */
-public class Ip2CountryManager extends AbstractManager
+//public class Ip2CountryManager extends AbstractManager
+public class Ip2CountryManager
 {   
     /**
      * Indicates if the database is fully loaded or not.
      */
-    private boolean isLoaded;
-    private List<IpCountryRange> ipCountryRangeList;
+//    private boolean isLoaded;
+//    private List<IpCountryRange> ipCountryRangeList;
+    private List ipCountryRangeList;
     
     
 
     private Ip2CountryManager()
     {
-        isLoaded = false;
-        ipCountryRangeList = new ArrayList<IpCountryRange>();
+//        isLoaded = false;
+//        ipCountryRangeList = new ArrayList<IpCountryRange>();
+        ipCountryRangeList = new ArrayList();
+/* cabos */
+        loadIp2CountryDB();
     }
 
     static private class Holder
@@ -64,15 +75,28 @@
         return Ip2CountryManager.Holder.manager;
     }
 
+    /* cabos */
+	public String getIP2Language(String ip, String defaultLocale) {
+        if (ip == null || ip.equals("")) return defaultLocale;
+
+        byte[] address = AddressUtils.parseIP(ip);
+        if (address == null) return defaultLocale;
+        
+        IpCountryRange range = binarySearch( address );
+        return (range != null) ? range.countryCode : defaultLocale;
+    }
+    
     /**
      * This method is called in order to initialize the manager.  Inside
      * this method you can't rely on the availability of other managers.
      * @return true if initialization was successful, false otherwise.
      */
+/*
     public boolean initialize()
     {
         return true;
     }
+*/
 
     /**
      * This method is called in order to perform post initialization of the
@@ -81,10 +105,12 @@
      * availability of other managers.
      * @return true if initialization was successful, false otherwise.
      */
+/*
     public boolean onPostInitialization()
     {
         return true;
     }
+*/
     
     /**
      * This method is called after the complete application including GUI completed
@@ -92,6 +118,7 @@
      * processes that needs to be performed once the application has successfully
      * completed startup.
      */
+/*
     public void startupCompletedNotify()
     {
         Runnable runnable = new Runnable()
@@ -103,12 +130,15 @@
         };
         ThreadPool.getInstance().addJob( runnable, "IP2CountryLoader" );
     }
+*/
 
     /**
      * This method is called in order to cleanly shutdown the manager. It
      * should contain all cleanup operations to ensure a nice shutdown of Phex.
      */
+/*
     public void shutdown(){}
+*/
     
     /**
      * Returns the country code if found, empty string if not found, and null
@@ -116,6 +146,7 @@
      * @param address
      * @return
      */
+/*
     public String getCountryCode( IpAddress address )
     {
         if ( !isLoaded )
@@ -129,9 +160,11 @@
         }
         return range.countryCode;
     }
+*/
     
     private void loadIp2CountryDB()
     {
+/*
         InputStream inStream = ClassLoader.getSystemResourceAsStream(
             "phex/resources/ip2country.csv" );
         if ( inStream == null )
@@ -141,8 +174,16 @@
             return;
         }
         BufferedReader reader = new BufferedReader( new InputStreamReader( inStream ) );
+*/
+        BufferedReader reader;
+        try {
+            reader = new BufferedReader( new FileReader( "ip2language.csv" ) );
+        } catch (Exception e) {
+            return;
+        }
         
-        ArrayList<IpCountryRange> initialList = new ArrayList<IpCountryRange>( 5000 );
+//        ArrayList<IpCountryRange> initialList = new ArrayList<IpCountryRange>( 5000 );
+        ArrayList initialList = new ArrayList( 5000 );
         IpCountryRange range;
         String line;
         try
@@ -157,7 +198,7 @@
         }
         catch (IOException exp)
         {
-            NLogger.error( NLoggerNames.GLOBAL, exp, exp );
+//            NLogger.error( NLoggerNames.GLOBAL, exp, exp );
         }
         finally
         {
@@ -166,7 +207,7 @@
         initialList.trimToSize();
         Collections.sort( initialList );
         ipCountryRangeList = Collections.unmodifiableList( initialList );
-        isLoaded = true;
+//        isLoaded = true;
     }
     
     private IpCountryRange binarySearch( byte[] hostIp )
@@ -177,7 +218,8 @@
         while (low <= high)
         {
             int mid = (low + high) >> 1;
-            IpCountryRange midVal = ipCountryRangeList.get( mid );
+//            IpCountryRange midVal = ipCountryRangeList.get( mid );
+            IpCountryRange midVal = (IpCountryRange)ipCountryRangeList.get( mid );
             int cmp = midVal.compareHostAddress( hostIp );
             if (cmp < 0)
             {
@@ -195,7 +237,8 @@
         return null;  // key not found
     }
     
-    private static class IpCountryRange implements Comparable<IpCountryRange>
+//    private static class IpCountryRange implements Comparable<IpCountryRange>
+    private static class IpCountryRange implements Comparable
     {
         byte[] from;
         byte[] to;
@@ -250,14 +293,16 @@
             }
         }
         
-        public int compareTo(IpCountryRange range)
+//        public int compareTo(IpCountryRange range)
+        public int compareTo(Object range)
         {
             if ( range == this )
             {
                 return 0;
             }            
             byte[] ip1 = from;
-            byte[] ip2 = range.from;
+//            byte[] ip2 = range.from;
+            byte[] ip2 = ((IpCountryRange)range).from;
 
             long ip1l = IOUtil.unsignedInt2Long( IOUtil.deserializeInt( ip1, 0 ) );
             long ip2l = IOUtil.unsignedInt2Long( IOUtil.deserializeInt( ip2, 0 ) );
Index: phex/utils/IOUtil.java
===================================================================
--- phex/utils/IOUtil.java	(revision 4098)
+++ phex/utils/IOUtil.java	(working copy)
@@ -2,6 +2,9 @@
  *  PHEX - The pure-java Gnutella-servent.
  *  Copyright (C) 2001 - 2007 Phex Development Group
  *
+ *  Modified by (c) 2004-2007 heavy_baby
+ *  heavy_baby@users.sourceforge.jp
+ *
  *  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
@@ -23,6 +26,7 @@
 
 
 import java.io.*;
+/*
 import java.net.InetAddress;
 import java.net.Socket;
 import java.util.zip.DataFormatException;
@@ -33,9 +37,11 @@
 import phex.common.file.ManagedFileException;
 import phex.common.file.ReadOnlyManagedFile;
 import phex.net.repres.SocketFacade;
-
+*/
+ 
 public class IOUtil
 {
+/*
     public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
 
     public static int serializeIntLE(int value, byte[] outbuf, int offset)
@@ -48,11 +54,13 @@
         // Return next offset.
         return offset;   
     }
+*/
     
     /**
      * Converts a int to a little-endian byte representation and writes it to the 
      * given stream.
      */
+/*
     public static void serializeIntLE( int value, OutputStream outStream )
         throws IOException
     {
@@ -119,6 +127,7 @@
         }
         return h|g|f|e|d|c|b|a;
     }
+ */
     
     /**
      * Returns the minimum bytes needed for the given value to encoded it in
@@ -126,6 +135,7 @@
      * @param value
      * @return
      */
+/*
     public static byte[] serializeInt2MinLE( int value )
     {
         if ( value < 0 )
@@ -141,6 +151,7 @@
         while ( value !=0 );
         return byteStream.toByteArray();
     }
+*/
     
     /**
      * Returns the minimum bytes needed for the given value to encoded it in
@@ -148,6 +159,7 @@
      * @param value
      * @return
      */
+/*
     public static byte[] serializeInt2MinLE( long value )
     {
         if ( value <= 0xFFFF )
@@ -177,12 +189,14 @@
             (byte) (value >> 16),
             (byte) (value >> 24) };
     }
+*/
     
     /**
      * Returns the minimum number of bytes needed to encode it in little-endian
      * format. Value must be positive.
      * @param value
      */
+/*
     public static byte[] serializeLong2MinLE( long value )
     {
         if ( value <= 0xFFFFFFFFFFFFFFL )
@@ -254,6 +268,7 @@
             (byte) (value >> 48), 
             (byte) (value >> 56) };
     }
+*/
     
     public static int deserializeInt( byte[] inbuf, int offset )
     {
@@ -271,6 +286,7 @@
      * @param offset
      * @return int indicating the next offset
      */
+/*
     public static int serializeShortLE(short value, byte[] outbuf, int offset)
     {
         outbuf[offset++] = (byte)(value);
@@ -279,17 +295,20 @@
         // Return next offset.
         return offset;
     }
+*/
     
     /**
      * Converts a short to a little-endian byte representation and writes it to the 
      * given stream.
      */
+/*
     public static void serializeShortLE( short value, OutputStream outStream )
         throws IOException
     {
         outStream.write( (byte)(value&0xFF) );
         outStream.write( (byte)((value >> 8) &0xFF) );
     }
+*/
 
 
     /**
@@ -300,6 +319,7 @@
      * @param offset
      * @return int indicating the next offset
      */
+/*
     public static int serializeShort(short value, byte[] outbuf, int offset)
     {
         outbuf[offset++] = (byte)(value >> 8);
@@ -308,17 +328,20 @@
         // Return next offset.
         return offset;
     }
+*/
     
     /**
      * Serialize a short, but do not convert it to little endian in the process 
      * given stream.
      */
+/*
     public static void serializeShort( short value, OutputStream outStream )
         throws IOException
     {
         outStream.write( (byte)((value >> 8) &0xFF) );
         outStream.write( (byte)(value&0xFF) );
     }
+*/
 
     /**
      * Deserialize a short, but do not convert it from little endian in the process
@@ -326,17 +349,20 @@
      * @param offset
      * @return short
      */
+/*
     public static short deserializeShort(byte[] inbuf, int offset)
     {
         return  (short) ((inbuf[offset] &0xff) <<  8 |
                          (inbuf[offset + 1]     &0xff));
     }
+*/
     
     /**
      * Deserialize a short, but do not convert it from little endian in the process
      * @param inStream
      * @return short
      */
+/*
     public static short deserializeShort( InputStream inStream )
         throws IOException
     {
@@ -344,6 +370,7 @@
         int b = inStream.read() & 0xFF;
         return (short) ( a | b );
     }
+*/
     
     /**
      * Deserialize a short, and convert it from little endian in the process
@@ -351,11 +378,13 @@
      * @param offset
      * @return short
      */
+/*
     public static short deserializeShortLE(byte[] inbuf, int offset)
     {
         return  (short) ((inbuf[offset + 1] &0xff) <<  8 |
                          (inbuf[offset]     &0xff));
     }
+*/
     
     /**
      * Deserialize a short, and convert it from little endian in the process
@@ -363,6 +392,7 @@
      * @param offset
      * @return short
      */
+/*
     public static short deserializeShortLE( InputStream inStream )
         throws IOException
     {
@@ -382,11 +412,13 @@
         return ((int)x) & 0x0000FFFF;
     }
 
+*/
     public static long unsignedInt2Long( int x )
     {
         return ((long)x) & 0x00000000FFFFFFFFl;
     }
     
+/*
     public static int castLong2Int( long x )
     {
         if ( x >= Integer.MAX_VALUE)
@@ -461,10 +493,12 @@
 
         return offset;
     }
+*/
     
     /**
      *
      */
+/*
     public static byte serializeGUESSVersionFormat(int majorVersion, int minorVersion) 
         throws IllegalArgumentException
     {
@@ -478,6 +512,7 @@
 
         return (byte)guessVersion;
     }
+*/
     
     /**
      * Reads the bytes of the stream till a byte has the value 0.
@@ -485,6 +520,7 @@
      * @return
      * @throws IOException
      */
+/*
     public static byte[] readBytesToNull( InputStream inStream )
         throws IOException
     {
@@ -496,6 +532,7 @@
         }
         return outStream.toByteArray();
     }
+*/
     
     /**
      * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
@@ -508,12 +545,14 @@
      * @throws NullPointerException if the input is null
      * @throws IOException if an I/O error occurs
      */
+/*
     public static byte[] toByteArray( InputStream input ) throws IOException
     {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
         copy( input, output );
         return output.toByteArray();
     }
+*/
 
     /**
      * Copy bytes from an <code>InputStream</code> to an
@@ -529,6 +568,7 @@
      * @throws IOException if an I/O error occurs
      * @since 1.1
      */
+/*
     public static int copy( InputStream input, OutputStream output )
         throws IOException
     {
@@ -542,6 +582,7 @@
         }
         return count;
     }
+*/
     
     
     /**
@@ -549,6 +590,7 @@
      * @param num the number to determine the log2 of. This is expceted to be a
      * power of 2
      */
+/*
     public static byte calculateCeilLog2( int value )
     {
         if      (value <=             0x10000)
@@ -585,12 +627,14 @@
             if      (value <=      0x20000000) return 29; else return 30;
         else return 31;
     }
+*/
 
     /**
      * Returns the logarithm to the based 2 of value.
      * @param num the number to determine the log2 of. This is expceted to be a
      * power of 2
      */
+/*
     public static byte calculateLog2( int value )
     {
         if      (value <             0x10000)
@@ -625,12 +669,14 @@
             if      (value <      0x20000000) return 28; else return 29;
         else return 30;
     }
+*/
 
 
     /**
      * Returns the number of significant bits of num.
      * @param num the number to determine the significant number of bits from.
      */
+/*
     public static int determineBitCount( int num )
     {
         if ( num < 0 )
@@ -672,10 +718,12 @@
             if      (num <      0x20000000) return 29; else return 30;
         else                                return 31;
     }
+*/
 
     /**
      * Uses a zip compression to compress a given data array.
      */
+/*
     public static byte[] deflate( byte[] data )
     {
         try
@@ -694,10 +742,12 @@
             return null;
         }
     }
+*/
 
     /**
      * Uses a zlib compression to decompress a given data array.
      */
+/*
     public static byte[] inflate( Inflater inflater, byte[] data )
         throws DataFormatException
     {
@@ -721,21 +771,25 @@
     
         return outStream.toByteArray();
     }
+*/
 
     /**
      * Uses a zlib compression to decompress a given data array.
      */
+/*
     public static byte[] inflate( byte[] data )
         throws DataFormatException
     {
         return inflate( new Inflater(), data );
     }
+*/
     
     /**
      * Use COBS to encode a byte array.
      * The eliminated byte value is 0x00
      * http://www.acm.org/sigcomm/sigcomm97/papers/p062.pdf
      */
+/*
     public static byte[] cobsEncode( byte[] data )
     {
         try
@@ -777,6 +831,7 @@
             return null;
         }
     }
+*/
 
     /**
      * Use COBS to decode a COBS-encoded byte array.
@@ -785,6 +840,7 @@
      * @return the decoded byte array..
      * @throws IOException 
      */
+/*
     public static byte[] cobsDecode( byte[] data ) throws IOException
     {       
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
@@ -813,12 +869,14 @@
         }
         return outStream.toByteArray();
     }
+*/
     
     /**
      * Unconditionally close an <code>OutputStream</code>.
      * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
      * @param output A (possibly null) OutputStream
      */
+/*
     public static void closeQuietly( OutputStream output )
     {
         if( output == null )
@@ -834,12 +892,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close a <code>Socket</code>.
      * Equivalent to {@link Socket#close()}, except any exceptions will be ignored.
      * @param socket A (possibly null) Socket
      */
+/*
     public static void closeQuietly( Socket socket )
     {
         if( socket == null )
@@ -855,12 +915,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close a <code>Socket</code>.
      * Equivalent to {@link Socket#close()}, except any exceptions will be ignored.
      * @param socket A (possibly null) Socket
      */
+/*
     public static void closeQuietly( SocketFacade socket )
     {
         if( socket == null )
@@ -876,12 +938,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close an <code>InputStream</code>.
      * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
      * @param input A (possibly null) InputStream
      */
+/*
     public static void closeQuietly( InputStream input )
     {
         if( input == null )
@@ -897,12 +961,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close an <code>Writer</code>.
      * Equivalent to {@link Writer#close()}, except any exceptions will be ignored.
      * @param writer A (possibly null) Writer
      */
+/*
     public static void closeQuietly( Writer writer )
     {
         if( writer == null )
@@ -918,6 +984,7 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close an <code>Reader</code>.
@@ -945,6 +1012,7 @@
      * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
      * @param input A (possibly null) InputStream
      */
+/*
     public static void closeQuietly( RandomAccessFile raf )
     {
         if( raf == null )
@@ -960,12 +1028,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close a <code>ManagedFile</code>.
      * Equivalent to {@link ManagedFile#closeFile()}, except any exceptions will be ignored.
      * @param input A (possibly null) InputStream
      */
+/*
     public static void closeQuietly( ManagedFile file )
     {
         if( file == null )
@@ -981,12 +1051,14 @@
         {
         }
     }
+*/
     
     /**
      * Unconditionally close a <code>ManagedFile</code>.
      * Equivalent to {@link ManagedFile#closeFile()}, except any exceptions will be ignored.
      * @param input A (possibly null) InputStream
      */
+/*
     public static void closeQuietly( ReadOnlyManagedFile file )
     {
         if( file == null )
@@ -1002,4 +1074,5 @@
         {
         }
     }
+*/
 }
\ No newline at end of file
Show on old repository browser