package z4; import java.io.IOException; import java.io.Reader; import java.io.StringReader; /* loaded from: classes2.dex */ public abstract class m { public static h a(g5.a aVar) { boolean a02 = aVar.a0(); aVar.K0(true); try { try { return b5.l.a(aVar); } catch (OutOfMemoryError e10) { throw new l("Failed parsing JSON source: " + aVar + " to Json", e10); } catch (StackOverflowError e11) { throw new l("Failed parsing JSON source: " + aVar + " to Json", e11); } } finally { aVar.K0(a02); } } public static h b(Reader reader) { try { g5.a aVar = new g5.a(reader); h a10 = a(aVar); if (!a10.l() && aVar.F0() != g5.b.END_DOCUMENT) { throw new o("Did not consume the entire document."); } return a10; } catch (g5.d e10) { throw new o(e10); } catch (IOException e11) { throw new i(e11); } catch (NumberFormatException e12) { throw new o(e12); } } public static h c(String str) { return b(new StringReader(str)); } }