LoginSignup
2
2

More than 5 years have passed since last update.

byte単位で指定された範囲の部分を文字列にして返す(固定長ファイル)

Last updated at Posted at 2013-07-01

たとえば固定長ファイルで3バイト目から9バイト目の範囲をひっぱってくるときに使う
Windows-31J前提

private String byteToString(byte[] bytes, int start, int end) throws UnsupportedEncodingException {
    byte[] targetByte = Arrays.copyOfRange(bytes, start, end);
    return new String(targetByte, "Windows-31J");
}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2