提交 09577b2b 编写于 作者: 檀越@新空间's avatar 檀越@新空间 🐭

fix:添加忽略文件

上级 abd5f2b5
...@@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets; ...@@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets;
* @version : 2.2.0 * @version : 2.2.0
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
public class ByteBuffer_001_Write { public class ByteBuffer_01_Write {
public static void main(String[] args) { public static void main(String[] args) {
final ByteBuffer b1 = StandardCharsets.UTF_8.encode("hello"); final ByteBuffer b1 = StandardCharsets.UTF_8.encode("hello");
final ByteBuffer b2 = StandardCharsets.UTF_8.encode("world"); final ByteBuffer b2 = StandardCharsets.UTF_8.encode("world");
......
...@@ -7,11 +7,7 @@ package com.kwan.shuyu.heima; ...@@ -7,11 +7,7 @@ package com.kwan.shuyu.heima;
* @version : 2.2.0 * @version : 2.2.0
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
public class ByteBuffer_003_split { public class ByteBuffer_03_split {
public static void main(String[] args) { public static void main(String[] args) {
} }
} }
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -11,7 +11,7 @@ import java.nio.channels.FileChannel; ...@@ -11,7 +11,7 @@ import java.nio.channels.FileChannel;
* @version : 2.2.0 * @version : 2.2.0
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
public class ByteBuffer_001_Test { public class ByteBuffer_01_Test_FileChannel {
public static void main(String[] args) { public static void main(String[] args) {
try (FileChannel channel = new FileInputStream("data.txt").getChannel()) { try (FileChannel channel = new FileInputStream("data.txt").getChannel()) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +14,7 @@ import java.nio.channels.FileChannel; ...@@ -14,7 +14,7 @@ import java.nio.channels.FileChannel;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_002_Test { public class ByteBuffer_02_Test_hasRemaining {
public static void main(String[] args) { public static void main(String[] args) {
try (FileChannel channel = new FileInputStream("data.txt").getChannel()) { try (FileChannel channel = new FileInputStream("data.txt").getChannel()) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll; ...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_003_Test_put { public class ByteBuffer_03_Test_put {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put((byte) 0x61); buffer.put((byte) 0x61);
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll; ...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_004_Test_flip { public class ByteBuffer_04_Test_flip {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put((byte) 0x61); buffer.put((byte) 0x61);
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll; ...@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_005_Test_compact { public class ByteBuffer_05_Test_compact {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put((byte) 0x61); buffer.put((byte) 0x61);
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer; ...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_006_Test_allocate { public class ByteBuffer_06_Test_allocate {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(ByteBuffer.allocate(16).getClass().getSimpleName()); System.out.println(ByteBuffer.allocate(16).getClass().getSimpleName());
System.out.println(ByteBuffer.allocateDirect(16).getClass().getSimpleName()); System.out.println(ByteBuffer.allocateDirect(16).getClass().getSimpleName());
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import com.kwan.shuyu.until.ByteBufferUtil; import com.kwan.shuyu.until.ByteBufferUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -13,7 +13,7 @@ import java.nio.ByteBuffer; ...@@ -13,7 +13,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_007_Test_read { public class ByteBuffer_07_Test_read {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put(new byte[]{'a', 'b', 'c', 'd'}); buffer.put(new byte[]{'a', 'b', 'c', 'd'});
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer; ...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_008_Test_mark { public class ByteBuffer_08_Test_mark {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put(new byte[]{'a', 'b', 'c', 'd'}); buffer.put(new byte[]{'a', 'b', 'c', 'd'});
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer; ...@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_009_Test_get { public class ByteBuffer_09_Test_get {
public static void main(String[] args) { public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10); ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.put(new byte[]{'a', 'b', 'c', 'd'}); buffer.put(new byte[]{'a', 'b', 'c', 'd'});
......
package com.kwan.shuyu.heima.bytebuffer; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -15,7 +15,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll; ...@@ -15,7 +15,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15 * @date : 2023/4/18 17:15
*/ */
@Slf4j @Slf4j
public class ByteBuffer_010_Test_String { public class ByteBuffer_10_Test_String {
public static void main(String[] args) { public static void main(String[] args) {
//方式一,不会自动切换到读模式 //方式一,不会自动切换到读模式
ByteBuffer buffer1 = ByteBuffer.allocate(16); ByteBuffer buffer1 = ByteBuffer.allocate(16);
......
package com.kwan.shuyu.heima; package com.kwan.shuyu.heima.netty_01_bytebuffer;
import com.kwan.shuyu.until.ByteBufferUtil; import com.kwan.shuyu.until.ByteBufferUtil;
...@@ -8,15 +8,15 @@ import java.nio.ByteBuffer; ...@@ -8,15 +8,15 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
/** /**
* 读取文件内容并打印ByteBuffer * 分散读取
* *
* @author : qinyingjie * @author : qinyingjie
* @version : 2.2.0 * @version : 2.2.0
* @date : 2023/4/18 18:01 * @date : 2023/4/18 18:01
*/ */
public class ByteBuffer_002_Read { public class ByteBuffer_11_Test_Read {
public static void main(String[] args) { public static void main(String[] args) {
try (RandomAccessFile file = new RandomAccessFile("/Users/qinyingjie/Documents/idea-workspace/ant/ant-netty/src/main/java/com/xiaofei/antnetty/3parts.txt", "rw")) { try (RandomAccessFile file = new RandomAccessFile("3parts.txt", "rw")) {
FileChannel channel = file.getChannel(); FileChannel channel = file.getChannel();
ByteBuffer a = ByteBuffer.allocate(3); ByteBuffer a = ByteBuffer.allocate(3);
ByteBuffer b = ByteBuffer.allocate(3); ByteBuffer b = ByteBuffer.allocate(3);
......
package com.kwan.shuyu.heima.netty_02_file;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* 检查文件是否存在
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/4/18 17:15
*/
public class File_01_Test_exists {
public static void main(String[] args) {
Path path = Paths.get(".gitignore");
System.out.println(Files.exists(path));
}
}
package com.kwan.shuyu.heima.nio.nio_001_block; package com.kwan.shuyu.heima.netty_03_nio.nio_01_block;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
......
package com.kwan.shuyu.heima.nio.nio_001_block; package com.kwan.shuyu.heima.netty_03_nio.nio_01_block;
import com.kwan.shuyu.until.ByteBufferUtil; import com.kwan.shuyu.until.ByteBufferUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
package com.kwan.shuyu.heima.nio.nio_002_no_block; package com.kwan.shuyu.heima.netty_03_nio.nio_02_no_block;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
......
package com.kwan.shuyu.heima.nio.nio_002_no_block; package com.kwan.shuyu.heima.netty_03_nio.nio_02_no_block;
import com.kwan.shuyu.until.ByteBufferUtil; import com.kwan.shuyu.until.ByteBufferUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
package com.kwan.shuyu.heima.nio.nio_003_selector; package com.kwan.shuyu.heima.netty_03_nio.nio_03_selector;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
......
package com.kwan.shuyu.heima.nio.nio_003_selector; package com.kwan.shuyu.heima.netty_03_nio.nio_03_selector;
import com.kwan.shuyu.until.ByteBufferUtil; import com.kwan.shuyu.until.ByteBufferUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册