Codota Logo
EncodingGuesser.guess
Code IndexAdd Codota to your IDE (free)

How to use
guess
method
in
org.deegree.commons.utils.EncodingGuesser

Best Java code snippets using org.deegree.commons.utils.EncodingGuesser.guess (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: deegree/deegree3

private static String getString( byte[] bs, Charset encoding )
            throws UnsupportedEncodingException {
  if ( encoding == null ) {
    encoding = guess( bs );
  }
  if ( encoding == null ) {
    encoding = Charset.forName( "UTF-8" );
  }
  return new String( bs, encoding );
}
origin: deegree/deegree3

/**
 * @param bs
 * @return the guessed encoding, or null
 * @throws UnsupportedEncodingException
 *             if you don't have i18n.jar from Sun's JDK, I guess
 */
public static Charset guess( byte[] bs )
            throws UnsupportedEncodingException {
  TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
  for ( byte b : bs ) {
    if ( ( b & 0xff ) < 128 ) {
      continue;
    }
    if ( map.containsKey( (int) b ) ) {
      map.put( (int) b, map.get( (int) b ) + 1 );
    } else {
      map.put( (int) b, 1 );
    }
  }
  return guess( map );
}
origin: deegree/deegree3

/**
 * @param in
 * @return the guessed encoding, or null, if none was determined
 * @throws IOException
 * @throws UnsupportedEncodingException
 *             if you don't have i18n.jar from Sun's JDK, I guess
 */
public static Charset guess( InputStream in )
            throws IOException {
  TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
  int b;
  while ( ( b = in.read() ) != -1 ) {
    if ( b < 128 ) {
      continue;
    }
    if ( map.containsKey( b ) ) {
      map.put( b, map.get( b ) + 1 );
    } else {
      map.put( b, 1 );
    }
  }
  return guess( map );
}
origin: deegree/deegree3

private static void printSummary( String s )
            throws IOException {
  boolean dbf = s.toLowerCase().endsWith( ".dbf" );
  BufferedInputStream in = new BufferedInputStream( new FileInputStream( s ) );
  if ( dbf ) {
    if ( in.skip( 32 ) != 32 ) {
      LOG.warn( "Could not skip 32 bytes, is the dbf broken?" );
    }
    int b;
    while ( ( b = in.read() ) != -1 ) {
      if ( b == 13 ) {
        break;
      }
    }
  }
  LOG.info( "Encoding for '" + s + "': " + guess( in ) );
}
org.deegree.commons.utilsEncodingGuesserguess

Popular methods of EncodingGuesser

    Popular in Java

    • Finding current android device location
    • setScale (BigDecimal)
    • setRequestProperty (URLConnection)
      Sets the general request property. If a property with the key already exists, overwrite its value wi
    • orElseThrow (Optional)
    • Runnable (java.lang)
      Represents a command that can be executed. Often used to run code in a different Thread.
    • DateFormat (java.text)
      Formats or parses dates and times.This class provides factories for obtaining instances configured f
    • Deque (java.util)
      A linear collection that supports element insertion and removal at both ends. The name deque is shor
    • Properties (java.util)
      The Properties class represents a persistent set of properties. The Properties can be saved to a st
    • TimeZone (java.util)
      TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
    • JarFile (java.util.jar)
      JarFile is used to read jar entries and their associated data from jar files.
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now