Java IO相互转换

byte[]和InputStream的相互转换

byte[]转换为InputStream

1
2
3
public static final InputStream bytes2InStream(byte[] buf) {
return new ByteArrayInputStream(buf);
}

InputStream转换为byte[]

1
2
3
4
5
6
7
8
9
10
public static final byte[] inStream2bytes(InputStream inStream) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
int len = 0;
while ((len = inStream.read(buff)) > 0) {
baos.write(buff, 0, len);
}
byte[] bytes = baos.toByteArray();
return bytes;
}

DDL与DML的区别

基本定义

  • DML(Data Manipulation Language) 数据操纵语言

适用范围:对数据库中的数据进行一些简单操作,如insert,delete,update,select

Shell字符串拼接

test.sh

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
your_name="AppBlog.CN"

# 使用双引号拼接
greeting_1="hello, "$your_name" !"
greeting_2="hello, ${your_name} !"
echo $greeting_1 $greeting_2

# 使用单引号拼接
greeting_3='hello, '$your_name' !'
greeting_4='hello, ${your_name} !'
echo $greeting_3 $greeting_4

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :