简体   繁体   English

将byte []解码为string [] []

[英]Decoding byte[] to string[][]

I am storing a string[][]-array into a database as a "blob". 我将字符串[] []数组作为“ blob”存储到数据库中。 Loading the data, I initially get a byte[]-array, which I then need to decode to string[][] again. 加载数据后,我最初得到一个byte []数组,然后需要再次将其解码为string [] []。

So: Can anywone tell me if there is a way to convert a byte[]-array to a string[][]-array (on Android)? 所以:谁能告诉我是否有一种方法可以将byte []-array转换为string [] []-array(在Android上)? Or if there is a way to convert a byte[]-array to an ArrayList ? 或者是否有一种方法可以将byte []-array转换为ArrayList?

I asked a similar question once, but the question was referring to blobs. 我曾经问过类似的问题,但是这个问题是指斑点。

You would normally convert a byte array to a single blob - why would you want an array of blobs? 通常,您会将字节数组转换为单个 blob-为什么要一个blob 数组 Would you want a single blob per byte? 您是否希望每个字节有一个Blob? That sounds unlikely. 听起来不太可能。

Creating a single blob for an array of bytes is easy though... for example, with a PreparedStatement : 不过,为字节数组创建单个blob很容易...例如,使用PreparedStatement

statement.setBlob(parameterIndex, bytes);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM