Top Description Inners Fields Constructors Methods
org.postgresql.core

public Class EncodingPredictor

extends Object
Class Inheritance
Imports
org.checkerframework.checker.nullness.qual.Nullable, java.io.IOException

Predicts encoding for error messages based on some heuristics.

  1. For certain languages, it is known how "FATAL" is translated
  2. For Japanese, several common words are hardcoded
  3. Then try various LATIN encodings

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
EncodingPredictor.DecodeResult

In certain cases the encoding is not known for sure (e.g. before authentication).

pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final EncodingPredictor.Translation[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static boolean
arrayContains(byte[] first, int firstOffset, int firstLength, byte[] second, int secondOffset, int secondLength)

public static @Nullable EncodingPredictor.DecodeResult
decode(byte[] bytes, int offset, int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FATAL_TRANSLATIONSback to summary
private static final EncodingPredictor.Translation[] FATAL_TRANSLATIONS

Constructor Detail

EncodingPredictorback to summary
public EncodingPredictor()

Method Detail

arrayContainsback to summary
private static boolean arrayContains(byte[] first, int firstOffset, int firstLength, byte[] second, int secondOffset, int secondLength)
decodeback to summary
public static @Nullable EncodingPredictor.DecodeResult decode(byte[] bytes, int offset, int length)
org.postgresql.core back to summary

public Class EncodingPredictor.DecodeResult

extends Object
Class Inheritance

In certain cases the encoding is not known for sure (e.g. before authentication). In such cases, backend might send messages in "native to database" encoding, thus pgjdbc has to guess the encoding nad

Field Summary

Modifier and TypeField and Description
public final @Nullable String
public final String

Constructor Summary

AccessConstructor and Description
pack-priv
DecodeResult(String result, @Nullable String encoding)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encodingback to summary
public final @Nullable String encoding
resultback to summary
public final String result

Constructor Detail

DecodeResultback to summary
pack-priv DecodeResult(String result, @Nullable String encoding)
org.postgresql.core back to summary

pack-priv Class EncodingPredictor.Translation

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public final String[]
public final @Nullable String
public final String
private final @Nullable String[]

Constructor Summary

AccessConstructor and Description
pack-priv
Translation(@Nullable String fatalText, @Nullable String[] texts, String language, String... encodings)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encodingsback to summary
public final String[] encodings
fatalTextback to summary
public final @Nullable String fatalText
languageback to summary
public final String language
textsback to summary
private final @Nullable String[] texts

Constructor Detail

Translationback to summary
pack-priv Translation(@Nullable String fatalText, @Nullable String[] texts, String language, String... encodings)