-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
timmy.oh
committed
Apr 21, 2023
1 parent
7613697
commit 4bb6701
Showing
32 changed files
with
560 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
https://www.tutorialspoint.com/java/java_files_io.htm | ||
- ![[Pasted image 20230421192923.png]] | ||
|
||
ByteStream | ||
- 8비트 바이트로 통신하는 듯 | ||
- FileInput/OutputStream | ||
|
||
Character Streams | ||
- 16비트 유니코드 쓰는듯 | ||
- **FileReader** and **FileWriter**. Though internally FileReader uses FileInputStream and FileWriter uses FileOutputStream but here the major difference is that FileReader reads two bytes at a time and FileWriter writes two bytes at a time. | ||
|
||
|
||
|
||
![[Pasted image 20230421193258.png]] | ||
|
||
https://victorydntmd.tistory.com/134 | ||
|
||
![[Pasted image 20230421195606.png]] | ||
![[Pasted image 20230421195653.png]] | ||
|
||
- 보조 스트림은 데코레이턴 패턴으로 쓴다. | ||
|
||
|
||
```java | ||
|
||
new BufferReader(new InputStreamReader(urlConnection.getInputStream())) | ||
|
||
|
||
``` | ||
|
||
- urlConnection.getInputStream 디버그 찍어보니 HttpInputStream 이다 | ||
- 이건 또 뭐냐.. | ||
- sun.net.www.protocol.http.HttpURLConnection.HttpInputStream | ||
- java.io.FilterInputStream 상속한거네 | ||
|
||
|
||
sun.net.www.protocol.http.HttpURLConnection#getInputStream0 | ||
![[Pasted image 20230421201357.png]] | ||
|
||
- sun.net.www.http.HttpClient#parseHTTP | ||
![[Pasted image 20230421201259.png]] | ||
- java.net.Socket#getInputStream | ||
- java.net.AbstractPlainSocketImpl#getInputStream | ||
![[Pasted image 20230421201152.png]] | ||
- sun.net.www.http.HttpClient#parseHTTPHeader | ||
- ![[Pasted image 20230421201844.png]] | ||
- 아.. Transfer-Encoding 이라는 헤더값의 디폴트가 Chunked 구나 | ||
- 그래서 위에서 만들어 놨던 보조스트림인 BufferedInputStream 을 받은 ChunkedInputStream 으로 변환된 후 뭔가 작업을 하는 군 | ||
|
||
|
||
|
||
자 다시 돌아와서 기본 코드 | ||
|
||
|
||
```java | ||
URL url = new URL("http://www.google.com"); | ||
URLConnection urlConnection = url.openConnection(); | ||
final InputStream inputStream = urlConnection.getInputStream(); | ||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); | ||
``` | ||
|
||
디버그찍어보면 | ||
|
||
|
||
![[Pasted image 20230421202033.png]] | ||
|
||
|
||
sun.net.www.protocol.http.HttpURLConnection.HttpInputStream | ||
![[Pasted image 20230421202112.png]] | ||
|
||
- 자 이것도 보조스트림이므로 FilterInputStream 상속하긴 함 일단 이거는 보인다 | ||
- 자 이거를 도대체 왜 읽을려고 InputStreamReader에 담아서 BufferedReader 에 담나? 그거는 BufferedReader를 쓸려고 그냥 바꾼거임 끝 | ||
|
||
|
||
|
||
|
||
> - 저 parseHeader 에 많은 정보가 있어보인다. | ||
> - 보조스트림, 주스트림 구분은 OK. 주스트림은 파일을 읽는 건데, 바이트 기반 vs 캐릭터 기반이 있는데 | ||
> - java.net.SocketInputStream 보면 이거는 FileInputStream 상속, 즉 바이트 기반 | ||
> - 이게 알 필요가 있냐고? 아직은 필요를 모르겠긴 함 헤더 Chunked 이정도만 알았네 | ||
> - 그래도 맨날 궁금했다 BufferedReader(머시기(머시기)) 딱 눈에 안들어왔는데 이제 들어오네 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
https://www.heecheolman.dev/post/%EA%B3%B5%EB%B3%80-%EB%B0%98%EA%B3%B5%EB%B3%80/ | ||
|
||
## 공변 (Covariance) | ||
|
||
공변이란 B가 A의 부분집합일 때 고차함수 T에 대해 `T<B>` 도 `T<A>` 의 부분집합이 되면 T는 "공변한다" 라고 합니다. 즉 A와 B의 관계가 유지될 때 공변한다고 말합니다. | ||
|
||
예시 1. 고양이와 동물 | ||
|
||
고양이는 동물의 부분집합, | ||
-> 동물에 고양이를 할당할 수 있고, 반대는 불가능 | ||
고양이배열, 동물배열은? | ||
-> 동물배열에 고양이배열을 할당할 수 있고, 반대는 불가능 | ||
|
||
=> 고차타입(뭐추상화된타입..??)을 적용했더니 관계가 유지 => 공변한다... | ||
|
||
|
||
### 쓸모 | ||
|
||
https://kdhyo98.tistory.com/83 | ||
|
||
![[Pasted image 20230420201138.png]] | ||
|
||
|
||
- 펙스(PECS), producer-extends, consumer-super | ||
|
||
흠... | ||
|
||
https://asuraiv.tistory.com/16 | ||
|
||
![[Pasted image 20230420202059.png]] | ||
|
||
|
||
음 예시를 보면 생산할려면 하위타입을 꺼내써야하므로 extends를 사용할 수 밖에 없고, 소비할려면 꺼내서 상위타입에 집어넣어야 하므로 super 를 사용할 수 밖에 없네 | ||
|
||
나도 코틀린 in out 보다가 이거 다시보게 됐는데 이사람도 똑같네 | ||
|
||
https://asuraiv.tistory.com/17 | ||
|
||
out : 소비할 수 없다. 즉 생산, 즉 extends | ||
in : 생산할수없다, 즉 소비, 즉 super | ||
|
||
> 음 이건 좀 더 쉽다 | ||
> 그냥 out 이면 리턴으로 사용, in 이면 파라미터로 사용 | ||
> 자 그럼 out이 extends 라는 건데 이건 뭐.. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
https://kotlinworld.com/255 | ||
|
||
|
||
![[Pasted image 20230412172438.png]] | ||
|
||
|
||
라고 하는데, 한방에 안 옴 | ||
|
||
apply : 객체에 뭔가 apply 한다 | ||
- 프로퍼티 세팅할 때 쓴다고 함 | ||
|
||
``` | ||
return a.apply { t = 1 } | ||
``` | ||
|
||
|
||
run : 객체 가지고 run 하고, 결과 리턴한다 | ||
- 보통 쓰는 듯. (낫널에 대해) | ||
|
||
with : 객체가지고 뭔가 하고 결과 리턴한다. (잘 안쓴단다) | ||
|
||
let : 객체를 요렇게 하도록 놔두고, 그 결과를 리턴한다 | ||
- null 이 아닐때만 let을 실행해서, null 체크 후에 쓸 때 유용하다고 함 | ||
|
||
also : 객체도 있다. (객체 그대로 리턴) | ||
- 프로퍼티 세팅하고, 다른 짓 할때 쓴다고 함 | ||
- 흠 위 블로그 예시가 이해가 안되는데 모르겠다 넘어간다 | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[하우투두인자바,페이징가상메모리](https://howtodoinjava.com/java/io/how-java-io-works-internally/) | ||
|
||
- 가상메모리 | ||
- 메모리 페이징 | ||
- 파일, 파일 락 | ||
- 블록, 스트림 | ||
|
||
[개발한입블로그,자바로구현및설명](https://brewagebear.github.io/fundamental-nio-and-io-models/) | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.