admin管理员组

文章数量:1530517

2024年5月31日发(作者:)

InputStream inSt;

HttpsURLConnection webRequest;

try {

String accessToken = (_TTS_ACCESS_TOKEN);

if (y(accessToken)) {

webRequest = psConnection(_TOKEN_URI);

nput(true);

utput(true);

nectTimeout(5000);

dTimeout(5000);

uestMethod("POST");

byte[] bytes = new byte[0];

uestProperty("content-length", f());

uestProperty("Ocp-Apim-Subscription-Key", _KEY);

t();

DataOutputStream dop = new DataOutputStream(putStream());

(bytes);

();

();

inSt = utStream();

InputStreamReader in = new InputStreamReader(inSt);

BufferedReader bufferedReader = new BufferedReader(in);

StringBuilder strBuffer = new StringBuilder();

String line = null;

while ((line = ne()) != null) {

(line);

}

();

();

();

nect();

accessToken = ng();

//设置accessToken的过期时间为9分钟

(_TTS_ACCESS_TOKEN, accessToken, _TOKEN_EXPIRE_TIME);

("New tts access token {}", accessToken);

}

return accessToken;

} catch (Exception e) {

("Generate tts access token failed {}", sage());

}

return null;

}

}

4.字节数组处理

public class ByteArray {

private byte[] data;

private int length;

public ByteArray(){

length = 0;

data = new byte[length];

}

public ByteArray(byte[] ba){

data = ba;

length = ;

}

/**

合并数组

*/

public void cat(byte[] second, int offset, int length){

if( + length > ) {

int allocatedLength = (, length);

byte[] allocated = new byte[allocatedLength << 1];

opy(data, 0, allocated, 0, );

opy(second, offset, allocated, , length);

data = allocated;

}else {

opy(second, offset, data, , length);

}

+= length;

}

本文标签: 语音数组设置时间文本