feat(init): 📌 初始化项目

This commit is contained in:
bunny 2024-05-22 16:53:48 +08:00
commit 421ceb0d2a
17 changed files with 152 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/bytebuffter.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

13
.idea/compiler.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="demo1" />
</profile>
</annotationProcessing>
</component>
</project>

8
.idea/encodings.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/demo1/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/demo1/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/demo1/src/main/resources-filtered" charset="UTF-8" />
</component>
</project>

14
.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/demo1/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/bytebuffter.iml" filepath="$PROJECT_DIR$/.idea/bytebuffter.iml" />
</modules>
</component>
</project>

16
demo1/pom.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.bunny</groupId>
<artifactId>demo1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>

View File

@ -0,0 +1,33 @@
package cn.bunny;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Demo01 {
public static void main(String[] args) {
// 输入流
try (FileChannel channel = new FileInputStream("D:\\MyFolder\\Netty\\byteBuffter\\data.txt").getChannel()) {
// 准备缓冲区
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
while (true) {
// 从channel 向buffer输入
int len = channel.read(byteBuffer);
if (len == -1) {
break;
}
// 输出buffer内容
byteBuffer.flip();
while (byteBuffer.hasRemaining()) {
byte b = byteBuffer.get();
System.out.println((char) b);
}
byteBuffer.clear();
}
} catch (IOException exception) {
}
}
}

View File

@ -0,0 +1,7 @@
package cn.bunny;
public class Demo02 {
public static void main(String[] args) {
System.out.println("asda");
}
}

View File

@ -0,0 +1,15 @@
package cn.bunny;
import java.nio.ByteBuffer;
public class Demo3 {
public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put((byte) 0x61);
buffer.put(new byte[]{0x62, 0x63, 0x64});
System.out.println(buffer);
}
}

View File

@ -0,0 +1,8 @@
sadasdsa das das dasas
dasasd
as
dasasdd as dasas
as
ad
a sadasdsa

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
sadasdsa das das dasas
dasasd
as
dasasdd as dasas
as
ad
a sadasdsa

View File

@ -0,0 +1,5 @@
D:\MyFolder\Netty\bytebuffter\demo1\src\main\java\cn\bunny\ByteBufferUtil.java
D:\MyFolder\Netty\bytebuffter\demo1\src\main\java\cn\bunny\Demo01.java
D:\MyFolder\Netty\bytebuffter\demo1\src\main\java\cn\bunny\Demo3.java
D:\MyFolder\Netty\bytebuffter\demo1\src\main\java\cn\bunny\Demo02.java
D:\MyFolder\Netty\bytebuffter\demo1\src\main\java\cn\bunny\Main.java