spring 常用方法

回滚

TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

InputStream 复用

    //转换
    private ByteArrayOutputStream toByteArrayOutputStream(InputStream input) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int len;
        while ((len = input.read(buffer)) > -1) {
            baos.write(buffer, 0, len);
        }
        baos.flush();
        return baos;
    }
    //调用
    new ByteArrayInputStream(baos.toByteArray())

特殊字符分割

url.split("\\\\"); '\'分割

猜你喜欢

转载自blog.csdn.net/xu622/article/details/81258818