diff --git "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.json" "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.json" new file mode 100644 index 0000000000000000000000000000000000000000..21ed7447b3e5725e91811c84ca5290b429ac9852 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "BufferRead.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.md" "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.md" new file mode 100644 index 0000000000000000000000000000000000000000..18369af72aa8f74e58cec429d5a400bb8ee91c50 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferRead.md" @@ -0,0 +1,73 @@ +# Buffer Read + + +以下关于 `Buffer` 的使用,正确的是: + + +## 答案 + +```java +import java.nio.DoubleBuffer; + +public class BufferTest { + public static void main(String[] args) { + DoubleBuffer doubleBuffer = DoubleBuffer.allocate(10); + doubleBuffer.put(12.0); + doubleBuffer.put(25.0); + doubleBuffer.flip(); + System.out.println(doubleBuffer.get()); + System.out.println(doubleBuffer.get()); + doubleBuffer.clear(); + } +} +``` + +## 选项 + +### A + +```java +import java.nio.CharBuffer; + +public class BufferTest { + public static void main(String[] args) { + CharBuffer charBuffer = CharBuffer.allocate(1); + charBuffer.put("test"); + charBuffer.flip(); + System.err.println(charBuffer.get()); + } +} +``` + +### B + +```java + +import java.nio.IntBuffer; + +public class BufferTest { + public static void main(String[] args) { + IntBuffer intBuffer = IntBuffer.allocate(1); + intBuffer.put(25); + intBuffer.put(12); + intBuffer.flip(); + System.err.println(intBuffer.get()); + System.err.println(intBuffer.get()); + } +} +``` + +### C + +```java +import java.nio.ByteBuffer; + +public class BufferTest { + public static void main(String[] args) { + ByteBuffer byteBuffer = ByteBuffer.allocate(10); + byte a = 12; + byteBuffer.put(a); + System.err.println(byteBuffer.get()); + } +} +``` diff --git "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.json" "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.json" new file mode 100644 index 0000000000000000000000000000000000000000..a5d2fcbdba0a5ba5f5e2b257dd942bdbb2c0a19f --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "clong", + "source": "BufferType.md", + "exercise_id": "", + "notebook_enable": true +} \ No newline at end of file diff --git "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.md" "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.md" new file mode 100644 index 0000000000000000000000000000000000000000..e4e3955947b4c3d5c11f6153c397c8c3a5f9cf31 --- /dev/null +++ "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/BufferType.md" @@ -0,0 +1,32 @@ +# Buffer Type + + +以下不属于Java NIO的 `Buffer` 类型的是: + + +## 答案 + +``` +StringBuffer +``` + +## 选项 + +### A + +``` +ByteBuffer +``` + +### B + +``` +CharBuffer +``` + +### C + +``` +DoubleBuffer +``` + diff --git "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/config.json" "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/config.json" index a36754cbbc62f96664679ca80b71f0821461348d..e6139846855e1bdb774155d3843b0b54cebd3ded 100644 --- "a/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/config.json" +++ "b/data/2.Java\344\270\255\351\230\266/5.NIO/2.Buffer\357\274\210\347\274\223\345\206\262\345\231\250\357\274\211/config.json" @@ -2,6 +2,6 @@ "node_id": "java-e622e94340ee4f00ae2aec33047cb19f", "keywords": [], "children": [], - "export": [], + "export": ["BufferType.json", "BufferRead.json"], "title": "Buffer(缓冲器)" } \ No newline at end of file