質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Q&A

解決済

2回答

404閲覧

アップデートファイルのURL解析について

退会済みユーザー

退会済みユーザー

総合スコア0

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

0グッド

0クリップ

投稿2019/02/08 01:53

アップデートするファイルが、どうしても欲しいが、その、アップデートのアプリをデコンパイルしたところよく分からないので、解読お願いします。

java

1/* 2 * Decompiled with CFR 0.0. 3 * 4 * Could not load the following classes: 5 * android.content.Context 6 * android.os.Build 7 * android.os.Build$VERSION 8 * android.telephony.TelephonyManager 9 * java.io.BufferedInputStream 10 * java.io.IOException 11 * java.io.InputStream 12 * java.lang.Integer 13 * java.lang.NumberFormatException 14 * java.lang.Object 15 * java.lang.String 16 * java.net.HttpURLConnection 17 * java.net.SocketTimeoutException 18 * java.net.URL 19 * java.net.URLConnection 20 */ 21package com.fujitsu.mobile_phone.versionup.networkclient; 22 23import android.content.Context; 24import android.os.Build; 25import android.telephony.TelephonyManager; 26import com.fujitsu.mobile_phone.versionup.FotaServerUrlPreference; 27import com.fujitsu.mobile_phone.versionup.UpdateFileModel; 28import com.fujitsu.mobile_phone.versionup.UpdateFileSizePreference; 29import com.fujitsu.mobile_phone.versionup.VersionManagementModel; 30import com.fujitsu.mobile_phone.versionup.networkclient.CommonNetworkClient; 31import com.fujitsu.mobile_phone.versionup.utility.Utility; 32import java.io.BufferedInputStream; 33import java.io.IOException; 34import java.io.InputStream; 35import java.net.HttpURLConnection; 36import java.net.SocketTimeoutException; 37import java.net.URL; 38import java.net.URLConnection; 39 40public class UpdateFileServerClient 41extends CommonNetworkClient { 42 private static final String TAG = "UpdateFileServerClient"; 43 private BufferedInputStream mBufferedInputStream; 44 private InputStream mInputStream; 45 private int mfilelength; 46 47 public int available() throws IOException { 48 return this.mBufferedInputStream.available(); 49 } 50 51 public void close() throws IOException { 52 Utility.LogOutput(2, TAG, "close() start"); 53 if (this.mBufferedInputStream != null) { 54 this.mBufferedInputStream.close(); 55 this.mBufferedInputStream = null; 56 } 57 Utility.LogOutput(2, TAG, "close() end"); 58 } 59 60 /* 61 * Enabled aggressive block sorting 62 * Enabled unnecessary exception pruning 63 * Enabled aggressive exception aggregation 64 */ 65 @Override 66 public int connection(Context context, String string2) throws IOException, SocketTimeoutException { 67 Utility.LogOutput(2, TAG, "connection() sta"); 68 this.mfilelength = 0; 69 this.setHttpConnection((HttpURLConnection)new URL(this.getUrl(context)).openConnection()); 70 this.getmHttpConnection().setRequestMethod("GET"); 71 this.getmHttpConnection().setUseCaches(false); 72 this.getmHttpConnection().setRequestProperty("User-Agent", this.getUa(context, string2)); 73 this.setPram(); 74 this.getmHttpConnection().connect(); 75 int n = this.getmHttpConnection().getResponseCode(); 76 if (n == 200) { 77 this.mfilelength = this.getmHttpConnection().getContentLength(); 78 } else if (n == 206) { 79 String[] arrstring = this.getmHttpConnection().getHeaderField("Content-Range").split("[/]"); 80 if (arrstring.length > 0) { 81 try { 82 this.mfilelength = Integer.parseInt((String)arrstring[-1 + arrstring.length]); 83 } 84 catch (NumberFormatException numberFormatException) { 85 Utility.LogOutput(4, TAG, "NumberFormatException e = " + (Object)numberFormatException); 86 } 87 } else { 88 this.mfilelength = 0; 89 Utility.LogOutput(4, TAG, "mfilelength = 0"); 90 } 91 } 92 Utility.LogOutput(3, TAG, "connection() ret = " + n); 93 Utility.LogOutput(3, TAG, "connection() mfilelength = " + this.mfilelength); 94 if (this.mfilelength <= 0) { 95 this.mfilelength = (int)UpdateFileSizePreference.getValue(context); 96 } 97 if (this.mfilelength < 0 && n != 500 && n != 416) { 98 n = -1; 99 } 100 if (n == 200 || n == 206) { 101 this.mBufferedInputStream = new BufferedInputStream(this.getmHttpConnection().getInputStream()); 102 } 103 Utility.LogOutput(3, TAG, "ret = " + n); 104 return n; 105 } 106 107 public int downloadFile(byte[] arrby) throws IOException { 108 Utility.LogOutput(2, TAG, "downloadFile() sta"); 109 BufferedInputStream bufferedInputStream = this.mBufferedInputStream; 110 int n = 0; 111 if (bufferedInputStream != null) { 112 n = this.mBufferedInputStream.read(arrby); 113 } 114 Utility.LogOutput(2, TAG, "downloadFile() end = " + n); 115 return n; 116 } 117 118 public int getFileSize() { 119 return this.mfilelength; 120 } 121 122 @Override 123 protected String getUa(Context context, String string2) { 124 Utility.LogOutput(2, TAG, "getUa() sta"); 125 String string3 = this.getReplaceUa("ImageUpdater (Linux; U; Android OSVERSION; MODEL Build/BUILDID IMEI MODE KITTINGVER)", Build.VERSION.RELEASE, VersionManagementModel.getInstance().getVersion(), ((TelephonyManager)context.getSystemService("phone")).getDeviceId(), string2, this.getKittingVersion(context)); 126 Utility.LogOutput(2, TAG, "getUa ret = " + string3); 127 return string3; 128 } 129 130 @Override 131 protected String getUrl(Context context) { 132 Utility.LogOutput(2, TAG, "getUrl() sta"); 133 String string2 = this.getReplaceUrl("/fujitsu/c/update/fujitsu/MODEL/update1/ap/dl/"); 134 String string3 = FotaServerUrlPreference.getValue(context); 135 if (string3.equals((Object)"DEFAULT")) { 136 string3 = "https://logfota.mobile-biz.jp.fujitsu.com"; 137 } 138 String string4 = string3 + string2 + VersionManagementModel.getInstance().getVersion() + "/" + this.getFileName(); 139 Utility.LogOutput(2, TAG, "getUrl ret = " + string4); 140 return string4; 141 } 142 143 @Override 144 protected void setPram() { 145 Utility.LogOutput(2, TAG, "setPram()"); 146 super.setPram(); 147 this.getmHttpConnection().setRequestProperty("Connection", "close"); 148 this.getmHttpConnection().setRequestProperty("Accept-Encoding", "identity"); 149 long l = new UpdateFileModel().getFileLength(); 150 if (l > 0L) { 151 this.getmHttpConnection().addRequestProperty("Accept-Ranges", "bytes"); 152 this.getmHttpConnection().addRequestProperty("Range", "bytes=" + l + "-"); 153 } 154 } 155 156 public int skip(int n) throws IOException { 157 this.mBufferedInputStream.skip((long)n); 158 return n; 159 } 160} 161 162

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_waiwai

2019/02/08 01:58

どこがどうわからないのか説明しましょう 丸投げにもほどがありますw
guest

回答2

0

こいつ・・・動くぞ!

投稿2019/02/08 04:28

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ベストアンサー

HTTP接続してファイルを取り込むためのクラスのようです.

投稿2019/02/08 04:26

jimbe

総合スコア12634

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/02/08 04:44

ありがとうございました。 感謝します。
jimbe

2019/02/08 08:06

回答しておいて何ですが, この回答で済む程度でしたら, ご自分で調査されたほうが今後に役立つと思います.
退会済みユーザー

退会済みユーザー

2019/02/09 01:08

アップデートの時の、ネットのキャプチャーを取ったら、解析できました。 変な質問をしてすみませんでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問