Quantcast
Channel: OKWAVE 閲覧数の多い質問(Java/253)【本日】
Viewing all articles
Browse latest Browse all 68675

int配列をbyte配列に変換

$
0
0
MIDPアプリを作成している初心者です。 Image データを一旦端末のレコードストアに保存しておく為、 getRGB()で取得したint配列を、byte配列に変換しなくてはいけません。 ↓のように レコードストアに書き込むメソッドを書いてみました。 public void writeRecordStore( String name, Image image ) {     int width = image.getWidth();     int height = image.getHeight();     int[] pxData = new int[ width*height ];     byte[] byteData;     RecordStore rs = null;     try {         //画像をバイトデータに変換         image.getRGB( pxData, 0, width, 0, 0, width, height );         //レコードストアを開く         rs = RecordStore.openRecordStore( name, true );         //バイト配列に変換 ← ここがわからない                  //レコードの追加         rs.addRecord( byteData, 0, byteData.length );              } catch( Exception e ) {     } } int配列をbyte配列に変換する方法わかる方 ご教授の程お願いします。 また、まだコーディングに自信が無いので、文法のミスもご指摘頂けたらありがたいです。

Viewing all articles
Browse latest Browse all 68675

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>