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
- 粉丝: 2317
- 资源: 5457
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- argumentError(解决方案).md
- simpleError(解决方案).md
- RangeError(解决方案).md
- 使用 Pandas 处理 Excel 数据:分割与展开列操作
- traits-6.3.2-cp311-cp311-win_amd64.whl.rar
- traits-6.3.2-cp311-cp311-win32.whl.rar
- traits-6.3.2-pp38-pypy38_pp73-win_amd64.whl.rar
- transformations-2019.1.1-cp34-cp34m-win_amd64.whl.rar
- traitsui-6.1.3-py2-none-any.whl.rar
- traitsui-7.3.1-py3-none-any.whl.rar
- transformations-2019.4.22-cp27-cp27m-win_amd64.whl.rar
- transformations-2019.4.22-cp27-cp27m-win32.whl.rar
- transformations-2019.1.1-cp34-cp34m-win32.whl.rar
- transformations-2020.1.1-cp36-cp36m-win_amd64.whl.rar
- transformations-2019.4.22-cp35-cp35m-win32.whl.rar
- transformations-2019.4.22-cp35-cp35m-win_amd64.whl.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功