package com.baselib.android.utils;
import com.alibaba.fastjson.util.IOUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.Selector;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
public class IOUtil {
public static final int EOF = -1;
public static final char DIR_SEPARATOR_UNIX = '/';
public static final char DIR_SEPARATOR_WINDOWS = '\\';
public static final String LINE_SEPARATOR_UNIX = "\n";
public static final String LINE_SEPARATOR_WINDOWS = "\r\n";
private static final int DEFAULT_BUFFER_SIZE = 4096;
private static final int SKIP_BUFFER_SIZE = 2048;
private static char[] SKIP_CHAR_BUFFER;
private static byte[] SKIP_BYTE_BUFFER;
public IOUtil() {
}
public static void close(URLConnection conn) {
if (conn instanceof HttpURLConnection) {
((HttpURLConnection) conn).disconnect();
}
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Reader input) {
closeQuietly((Closeable) input);
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Writer output) {
closeQuietly((Closeable) output);
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(InputStream input) {
closeQuietly((Closeable) input);
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(OutputStream output) {
closeQuietly((Closeable) output);
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException var2) {
}
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Closeable... closeables) {
if (closeables != null) {
Closeable[] var1 = closeables;
int var2 = closeables.length;
for (int var3 = 0; var3 < var2; ++var3) {
Closeable closeable = var1[var3];
closeQuietly(closeable);
}
}
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Socket sock) {
if (sock != null) {
try {
sock.close();
} catch (IOException var2) {
}
}
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(Selector selector) {
if (selector != null) {
try {
selector.close();
} catch (IOException var2) {
}
}
}
/**
* @deprecated
*/
@Deprecated
public static void closeQuietly(ServerSocket sock) {
if (sock != null) {
try {
sock.close();
} catch (IOException var2) {
}
}
}
public static BufferedReader toBufferedReader(Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
public static BufferedReader toBufferedReader(Reader reader, int size) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader, size);
}
public static BufferedReader buffer(Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
public static BufferedReader buffer(Reader reader, int size) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader, size);
}
public static BufferedWriter buffer(Writer writer) {
return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer);
}
public static BufferedWriter buffer(Writer writer, int size) {
return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer, size);
}
public static BufferedOutputStream buffer(OutputStream outputStream) {
if (outputStream == null) {
throw new NullPointerException();
} else {
return outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream);
}
}
public static BufferedOutputStream buffer(OutputStream outputStream, int size) {
if (outputStream == null) {
throw new NullPointerException();
} else {
return outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream, size);
}
}
public static BufferedInputStream buffer(InputStream inputStream) {
if (inputStream == null) {
throw new NullPointerException();
} else {
return inputStream instanceof BufferedInputStream ? (BufferedInputStream) inputStream : new BufferedInputStream(inputStream);
}
}
public static BufferedInputStream buffer(InputStream inputStream, int size) {
if (inputStream == null) {
throw new NullPointerException();
} else {
return inputStream instanceof BufferedInputStream ? (BufferedInputStream) inputStream : new BufferedInputStream(inputStream, size);
}
}
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
Throwable var2 = null;
byte[] var3;
try {
copy((InputStream) input, (OutputStream) output);
var3 = output.toByteArray();
} catch (Throwable var12) {
var2 = var12;
throw var12;
} finally {
if (output != null) {
if (var2 != null) {
try {
output.close();
} catch (Throwable var11) {
var2.addSuppressed(var11);
}
} else {
output.close();
}
}
}
return var3;
}
public static byte[] toByteArray(InputStream input, long size) throws IOException {
if (size > 2147483647L) {
throw new IllegalArgumentException("Size cannot be greater than Integer max value: " + size);
} else {
return toByteArray(input, (int) size);
}
}
public static byte[] toByteArray(InputStream input, int size) throws IOException {
if (size < 0) {
throw new IllegalArgumentException("Size must be equal or greater than zero: " + size);
} else if (size == 0) {
return new byte[0];
} else {
byte[] data = new byte[size];
int offset;
int read;
for (offset = 0; offset < size && (read = input.read(data, offset, size - offset)) != -1; offset += read) {
}
if (offset != size) {
throw new IOException("Unexpected read size. current: " + offset + ", expected: " + size);
} else {
return data;
}
}
}
/**
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该项目为基于Java语言的Android课程设计源码课件,包含306个文件,涵盖154个Java源文件、89个XML配置文件、25个WebP图片文件、13个PNG图片文件、5个Git忽略文件、5个Gradle文件、3个属性文件以及2个JDK密钥库和JAR文件。课件内容丰富,适用于Android开发学习与教学。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java语言的Android课程设计源码课件 (306个子文件)
gradlew.bat 3KB
.gitignore 1KB
.gitignore 47B
.gitignore 16B
.gitignore 15B
.gitignore 6B
build.gradle 3KB
build.gradle 1KB
build.gradle 1KB
settings.gradle 1003B
build.gradle 213B
gradlew 6KB
commons-lang-2.5.jar 273KB
gradle-wrapper.jar 58KB
IOUtil.java 31KB
TimeUtils.java 31KB
DateTools.java 26KB
NumberProgressBar.java 17KB
UriUtils.java 15KB
ImageLoader.java 15KB
Base64.java 14KB
Common.java 12KB
BaseNCodec.java 11KB
ImAndroidDataOperate.java 11KB
BeanRefUtil.java 10KB
DownLoadService.java 9KB
DisplayUtil.java 9KB
PermissionController.java 9KB
GpsActivity.java 8KB
BluetoothActivity.java 8KB
RefreshLayout.java 7KB
VersionActivity.java 6KB
HomeActivity.java 6KB
FileUtils.java 6KB
ActivityIntent.java 5KB
LoginActivity.java 5KB
UriUtil.java 5KB
PreferceManager.java 5KB
BaseActivity.java 5KB
PositiveDialog.java 4KB
ViewUtil.java 4KB
HttpReq.java 4KB
UploadImageAcivity.java 4KB
VideoFragment.java 4KB
BaseNewsNetFragment.java 4KB
CameraVideoActivity.java 4KB
BaseRAadapter.java 4KB
BasePlatAdapter.java 3KB
ProgressWebView.java 3KB
MainActivity.java 3KB
GsonUtil.java 3KB
HttpManager.java 3KB
ImDBHelper.java 3KB
LoginActivity.java 3KB
ImDBFactory.java 3KB
SoftKeyboardStateHelper.java 3KB
LoginViewModel.java 2KB
HexUtil.java 2KB
EndLessOnScrollListener.java 2KB
UploadController.java 2KB
IntentActivity.java 2KB
ConstraintLayoutActivity.java 2KB
BaseFragment.java 2KB
MyBitmapImageViewTarget.java 2KB
HttpConfigBean.java 2KB
BaseApp.java 2KB
GlideRoundTransform.java 2KB
BaseNetActivity.java 2KB
NoScrollWebView.java 2KB
OkHttpUtils.java 2KB
PermissionManager.java 2KB
NewsController.java 2KB
Logger.java 2KB
NewsFragment.java 2KB
MD5Util.java 2KB
FunFragment.java 2KB
ToastTool.java 2KB
MilitaryFragment.java 2KB
HttpActivity.java 2KB
DensityUtils.java 2KB
SchFragment.java 2KB
LoginRepository.java 2KB
HomePageAdaper.java 2KB
GlideCircleTransform.java 2KB
IntentTargetActivity.java 2KB
ViewActivity.java 2KB
LoadActivity.java 2KB
HomeFragment.java 1KB
VideoNewsAdapter.java 1KB
LifeCycleActivity.java 1KB
StringUtils.java 1KB
MainPageActivity.java 1KB
Charsets.java 1KB
NewsVo.java 1KB
WebNewsAdapter.java 1KB
WebviewActivity.java 1KB
BottomViewBehavior.java 1KB
Charsets.java 1KB
Result.java 1KB
SysPermission.java 1KB
共 306 条
- 1
- 2
- 3
- 4
资源评论
wjs2024
- 粉丝: 2439
- 资源: 5553
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 使用STM32F103C8T6和ESP8266链接阿里云
- 聚英翱翔-嵌入式面试题
- HTH_ND AIO v2.8.4.zip
- MATLAB Simulink汽车电动助力转向模型EPS模型 模型包括整车二自由度模型,eps模型,上下转向柱模型,包括整车参数,匹配,建模 电动助力转向系统控制系统 电动助力转向系统被控系统 逻辑门
- 级联H桥 采用载波层叠,级联度为2,输出电平数为5
- 440大神vb.net基于winform产品进销存管理系统毕业课程源码设计
- 整流器MATLAB模型,可以用于模拟交流侧向电动汽车充电等背景 交流侧电压173V,输出电压400V,效果良好 采用电压电流双闭环,SVPWM调制
- 小电流接地系统simulink仿真 包括中性点不接地系统、中性点经消弧线圈系统适用于配电网接地选线与定位、消弧等
- Fast Video Cutter Joiner v6.3.0 一款功能强大的切割和合并视频视频编辑软件.rar
- 基于扩展卡尔曼滤波的蓄电池组SOC估算 Matlab Simulink仿真模型(成品)
- 441大神C#基于winform酒店客房预订管理系统毕业课程源码设计
- 大学生HTML5期末作业 Web前端网页制作 html5+css3+js html+css+js网页设计 体育 北京邮电大学体育部11个页面
- ACS510变频器Modbus通信参数配置与调试详解
- 基于R语言的DICE模型实践技术应用
- 西门子G120XA变频器高效节能与简易调试方法解析
- 442大神vb.net基于winform酒店客房预订管理系统毕业课程源码设计
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功