| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
- curl
- io
- Ollama
- 절대경로
- 시작하기
- vscode
- RandomAccessFile
- cli
- Vite
- docker
- .dockerignore
- html canvas
- Docker Compose
- qwen3-coder-next
- Java
- FileChannel
- dockerfile
- podman compose
- React
- config
- File
- podman
- glm-ocr
- Webpack
- Typescript
- path
- getting started
- tauri
- Today
- Total
목록정리/Java (3)
워로디스
아래는 Java의 RandomAccessFile 클래스를 사용하여 파일의 특정 offset부터 length만큼 byte[]로 읽는 예제 코드입니다. import java.io.File;import java.io.IOException;import java.io.RandomAccessFile;public class FileReadExample { public static byte[] readBytesFromFile(File file, long offset, int length) throws IOException { try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { // 파일 크기 확인 lo..
Java NIO (New Input/Output)에서 채널(Channel)은 파일이나 네트워크 소켓 등의 I/O 서비스에 대한 연결을 나타냅니다. Java NIO의 FileChannel 클래스는 파일에 대한 랜덤 엑세스를 가능하게 합니다. 이 클래스를 사용하면 파일의 특정 위치로 이동하여 데이터를 읽거나 쓸 수 있습니다. RandomAccessFile 클래스와 함께 FileChannel을 사용하여 파일에 랜덤 엑세스를 수행할 수 있습니다. 예를 들어, 파일에서 특정 위치로 이동하고 데이터를 읽거나 쓰는 것이 가능합니다. 다음은 Java NIO를 사용하여 파일에 랜덤 엑세스하는 간단한 예제입니다.import java.io.RandomAccessFile;import java.nio.ByteBuffer;imp..
Java에서 경로가 절대경로인지 확인하려면 java.io.File 또는 java.nio.file.Path의 메서드를 사용할 수 있습니다. 1. File.isAbsolute() 사용import java.io.File;public class Main { public static void main(String[] args) { File file1 = new File("/usr/local/bin"); // UNIX-style 절대경로 File file2 = new File("data/input.txt"); // 상대경로 System.out.println(file1.isAbsolute()); // true System.out.println(file2.is..
