aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/d/a.java
blob: 58c89ba8405dd5a78537c002da224e342a075f16 (plain)
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
package kr.syeyoung.dungeonsguide.d;

import kr.syeyoung.dungeonsguide.b;

import java.io.*;
import java.net.URL;
import java.net.URLConnection;

public class a extends URLConnection {
    private b a;
    protected a(URL b, b a) {
        super(b);
        connected = false;
        this.a = a;
    }

    @Override
    public void connect() throws IOException {
    }
    @Override
    public InputStream getInputStream() throws IOException {
        if (a != null) {
            String path = url.getPath().substring(1);
            if (!a.d().containsKey(path)) throw new FileNotFoundException();
            return new ByteArrayInputStream(a.d().get(path));
        } else if (url.getPath().contains("roomdata")){
            return a.class.getResourceAsStream(url.getPath());
        }
        throw new FileNotFoundException();
    }
}