summaryrefslogtreecommitdiff
path: root/sources/scala/tools/util/CharArrayFile.java
blob: 55c8f4a19d48a805e1bc66b6a5c5d0f153db7d50 (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package scala.tools.util;

/**
 * This class implements an abstract regular file backed by a
 * character array.
 */
public class CharArrayFile extends VirtualFile {

    //########################################################################
    // Private Fields

    /** The character array */
    private final char[] chars;

    //########################################################################
    // Public Constructors

    /**
     * Initializes this instance with the specified name, an identical
     * path and the specified character array.
     */
    public CharArrayFile(String name, char[] chars) {
        this(name, name, chars);
    }

    /**
     * Initializes this instance with the specified name, path and
     * character array.
     */
    public CharArrayFile(String name, String path, char[] chars) {
        super(name, path);
        this.chars = chars;
    }

    //########################################################################
    // Public Methods

    /** Reads the content of this abstract file into a byte array. */
    public byte[] read() {
        assert false: "!!! not yet implemented";
        return new String(chars).getBytes(); // !!!
    }

    //########################################################################
}