rt/emul/compact/src/main/java/java/io/FileOutputStream.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 03 Oct 2013 17:36:44 +0200
changeset 1337 c794024954b5
parent 1334 588d5bf7a560
permissions -rw-r--r--
Implementation of few more JDK classes
jtulach@1334
     1
/*
jtulach@1334
     2
 * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
jtulach@1334
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jtulach@1334
     4
 *
jtulach@1334
     5
 * This code is free software; you can redistribute it and/or modify it
jtulach@1334
     6
 * under the terms of the GNU General Public License version 2 only, as
jtulach@1334
     7
 * published by the Free Software Foundation.  Oracle designates this
jtulach@1334
     8
 * particular file as subject to the "Classpath" exception as provided
jtulach@1334
     9
 * by Oracle in the LICENSE file that accompanied this code.
jtulach@1334
    10
 *
jtulach@1334
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jtulach@1334
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jtulach@1334
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jtulach@1334
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jtulach@1334
    15
 * accompanied this code).
jtulach@1334
    16
 *
jtulach@1334
    17
 * You should have received a copy of the GNU General Public License version
jtulach@1334
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jtulach@1334
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jtulach@1334
    20
 *
jtulach@1334
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jtulach@1334
    22
 * or visit www.oracle.com if you need additional information or have any
jtulach@1334
    23
 * questions.
jtulach@1334
    24
 */
jtulach@1334
    25
jtulach@1334
    26
package java.io;
jtulach@1334
    27
jtulach@1334
    28
jtulach@1334
    29
jtulach@1334
    30
/**
jtulach@1334
    31
 * A file output stream is an output stream for writing data to a
jtulach@1334
    32
 * <code>File</code> or to a <code>FileDescriptor</code>. Whether or not
jtulach@1334
    33
 * a file is available or may be created depends upon the underlying
jtulach@1334
    34
 * platform.  Some platforms, in particular, allow a file to be opened
jtulach@1334
    35
 * for writing by only one <tt>FileOutputStream</tt> (or other
jtulach@1334
    36
 * file-writing object) at a time.  In such situations the constructors in
jtulach@1334
    37
 * this class will fail if the file involved is already open.
jtulach@1334
    38
 *
jtulach@1334
    39
 * <p><code>FileOutputStream</code> is meant for writing streams of raw bytes
jtulach@1334
    40
 * such as image data. For writing streams of characters, consider using
jtulach@1334
    41
 * <code>FileWriter</code>.
jtulach@1334
    42
 *
jtulach@1334
    43
 * @author  Arthur van Hoff
jtulach@1334
    44
 * @see     java.io.File
jtulach@1334
    45
 * @see     java.io.FileDescriptor
jtulach@1334
    46
 * @see     java.io.FileInputStream
jtulach@1334
    47
 * @see     java.nio.file.Files#newOutputStream
jtulach@1334
    48
 * @since   JDK1.0
jtulach@1334
    49
 */
jtulach@1334
    50
public
jtulach@1334
    51
class FileOutputStream extends OutputStream
jtulach@1334
    52
{
jtulach@1334
    53
    /**
jtulach@1334
    54
     * The system dependent file descriptor.
jtulach@1334
    55
     */
jtulach@1334
    56
    private final FileDescriptor fd;
jtulach@1334
    57
jtulach@1334
    58
    /**
jtulach@1334
    59
     * True if the file is opened for append.
jtulach@1334
    60
     */
jtulach@1334
    61
    private final boolean append;
jtulach@1334
    62
jtulach@1334
    63
    /**
jtulach@1334
    64
     * The associated channel, initalized lazily.
jtulach@1334
    65
     */
jaroslav@1337
    66
//    private FileChannel channel;
jtulach@1334
    67
jtulach@1334
    68
    private final Object closeLock = new Object();
jtulach@1334
    69
    private volatile boolean closed = false;
jtulach@1334
    70
    private static final ThreadLocal<Boolean> runningFinalize =
jtulach@1334
    71
        new ThreadLocal<>();
jtulach@1334
    72
jtulach@1334
    73
    private static boolean isRunningFinalize() {
jtulach@1334
    74
        Boolean val;
jtulach@1334
    75
        if ((val = runningFinalize.get()) != null)
jtulach@1334
    76
            return val.booleanValue();
jtulach@1334
    77
        return false;
jtulach@1334
    78
    }
jtulach@1334
    79
jtulach@1334
    80
    /**
jtulach@1334
    81
     * Creates a file output stream to write to the file with the
jtulach@1334
    82
     * specified name. A new <code>FileDescriptor</code> object is
jtulach@1334
    83
     * created to represent this file connection.
jtulach@1334
    84
     * <p>
jtulach@1334
    85
     * First, if there is a security manager, its <code>checkWrite</code>
jtulach@1334
    86
     * method is called with <code>name</code> as its argument.
jtulach@1334
    87
     * <p>
jtulach@1334
    88
     * If the file exists but is a directory rather than a regular file, does
jtulach@1334
    89
     * not exist but cannot be created, or cannot be opened for any other
jtulach@1334
    90
     * reason then a <code>FileNotFoundException</code> is thrown.
jtulach@1334
    91
     *
jtulach@1334
    92
     * @param      name   the system-dependent filename
jtulach@1334
    93
     * @exception  FileNotFoundException  if the file exists but is a directory
jtulach@1334
    94
     *                   rather than a regular file, does not exist but cannot
jtulach@1334
    95
     *                   be created, or cannot be opened for any other reason
jtulach@1334
    96
     * @exception  SecurityException  if a security manager exists and its
jtulach@1334
    97
     *               <code>checkWrite</code> method denies write access
jtulach@1334
    98
     *               to the file.
jtulach@1334
    99
     * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
jtulach@1334
   100
     */
jtulach@1334
   101
    public FileOutputStream(String name) throws FileNotFoundException {
jtulach@1334
   102
        this(name != null ? new File(name) : null, false);
jtulach@1334
   103
    }
jtulach@1334
   104
jtulach@1334
   105
    /**
jtulach@1334
   106
     * Creates a file output stream to write to the file with the specified
jtulach@1334
   107
     * name.  If the second argument is <code>true</code>, then
jtulach@1334
   108
     * bytes will be written to the end of the file rather than the beginning.
jtulach@1334
   109
     * A new <code>FileDescriptor</code> object is created to represent this
jtulach@1334
   110
     * file connection.
jtulach@1334
   111
     * <p>
jtulach@1334
   112
     * First, if there is a security manager, its <code>checkWrite</code>
jtulach@1334
   113
     * method is called with <code>name</code> as its argument.
jtulach@1334
   114
     * <p>
jtulach@1334
   115
     * If the file exists but is a directory rather than a regular file, does
jtulach@1334
   116
     * not exist but cannot be created, or cannot be opened for any other
jtulach@1334
   117
     * reason then a <code>FileNotFoundException</code> is thrown.
jtulach@1334
   118
     *
jtulach@1334
   119
     * @param     name        the system-dependent file name
jtulach@1334
   120
     * @param     append      if <code>true</code>, then bytes will be written
jtulach@1334
   121
     *                   to the end of the file rather than the beginning
jtulach@1334
   122
     * @exception  FileNotFoundException  if the file exists but is a directory
jtulach@1334
   123
     *                   rather than a regular file, does not exist but cannot
jtulach@1334
   124
     *                   be created, or cannot be opened for any other reason.
jtulach@1334
   125
     * @exception  SecurityException  if a security manager exists and its
jtulach@1334
   126
     *               <code>checkWrite</code> method denies write access
jtulach@1334
   127
     *               to the file.
jtulach@1334
   128
     * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
jtulach@1334
   129
     * @since     JDK1.1
jtulach@1334
   130
     */
jtulach@1334
   131
    public FileOutputStream(String name, boolean append)
jtulach@1334
   132
        throws FileNotFoundException
jtulach@1334
   133
    {
jtulach@1334
   134
        this(name != null ? new File(name) : null, append);
jtulach@1334
   135
    }
jtulach@1334
   136
jtulach@1334
   137
    /**
jtulach@1334
   138
     * Creates a file output stream to write to the file represented by
jtulach@1334
   139
     * the specified <code>File</code> object. A new
jtulach@1334
   140
     * <code>FileDescriptor</code> object is created to represent this
jtulach@1334
   141
     * file connection.
jtulach@1334
   142
     * <p>
jtulach@1334
   143
     * First, if there is a security manager, its <code>checkWrite</code>
jtulach@1334
   144
     * method is called with the path represented by the <code>file</code>
jtulach@1334
   145
     * argument as its argument.
jtulach@1334
   146
     * <p>
jtulach@1334
   147
     * If the file exists but is a directory rather than a regular file, does
jtulach@1334
   148
     * not exist but cannot be created, or cannot be opened for any other
jtulach@1334
   149
     * reason then a <code>FileNotFoundException</code> is thrown.
jtulach@1334
   150
     *
jtulach@1334
   151
     * @param      file               the file to be opened for writing.
jtulach@1334
   152
     * @exception  FileNotFoundException  if the file exists but is a directory
jtulach@1334
   153
     *                   rather than a regular file, does not exist but cannot
jtulach@1334
   154
     *                   be created, or cannot be opened for any other reason
jtulach@1334
   155
     * @exception  SecurityException  if a security manager exists and its
jtulach@1334
   156
     *               <code>checkWrite</code> method denies write access
jtulach@1334
   157
     *               to the file.
jtulach@1334
   158
     * @see        java.io.File#getPath()
jtulach@1334
   159
     * @see        java.lang.SecurityException
jtulach@1334
   160
     * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
jtulach@1334
   161
     */
jtulach@1334
   162
    public FileOutputStream(File file) throws FileNotFoundException {
jtulach@1334
   163
        this(file, false);
jtulach@1334
   164
    }
jtulach@1334
   165
jtulach@1334
   166
    /**
jtulach@1334
   167
     * Creates a file output stream to write to the file represented by
jtulach@1334
   168
     * the specified <code>File</code> object. If the second argument is
jtulach@1334
   169
     * <code>true</code>, then bytes will be written to the end of the file
jtulach@1334
   170
     * rather than the beginning. A new <code>FileDescriptor</code> object is
jtulach@1334
   171
     * created to represent this file connection.
jtulach@1334
   172
     * <p>
jtulach@1334
   173
     * First, if there is a security manager, its <code>checkWrite</code>
jtulach@1334
   174
     * method is called with the path represented by the <code>file</code>
jtulach@1334
   175
     * argument as its argument.
jtulach@1334
   176
     * <p>
jtulach@1334
   177
     * If the file exists but is a directory rather than a regular file, does
jtulach@1334
   178
     * not exist but cannot be created, or cannot be opened for any other
jtulach@1334
   179
     * reason then a <code>FileNotFoundException</code> is thrown.
jtulach@1334
   180
     *
jtulach@1334
   181
     * @param      file               the file to be opened for writing.
jtulach@1334
   182
     * @param     append      if <code>true</code>, then bytes will be written
jtulach@1334
   183
     *                   to the end of the file rather than the beginning
jtulach@1334
   184
     * @exception  FileNotFoundException  if the file exists but is a directory
jtulach@1334
   185
     *                   rather than a regular file, does not exist but cannot
jtulach@1334
   186
     *                   be created, or cannot be opened for any other reason
jtulach@1334
   187
     * @exception  SecurityException  if a security manager exists and its
jtulach@1334
   188
     *               <code>checkWrite</code> method denies write access
jtulach@1334
   189
     *               to the file.
jtulach@1334
   190
     * @see        java.io.File#getPath()
jtulach@1334
   191
     * @see        java.lang.SecurityException
jtulach@1334
   192
     * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
jtulach@1334
   193
     * @since 1.4
jtulach@1334
   194
     */
jtulach@1334
   195
    public FileOutputStream(File file, boolean append)
jtulach@1334
   196
        throws FileNotFoundException
jtulach@1334
   197
    {
jaroslav@1337
   198
        throw new SecurityException();
jtulach@1334
   199
    }
jtulach@1334
   200
jtulach@1334
   201
    /**
jtulach@1334
   202
     * Creates a file output stream to write to the specified file
jtulach@1334
   203
     * descriptor, which represents an existing connection to an actual
jtulach@1334
   204
     * file in the file system.
jtulach@1334
   205
     * <p>
jtulach@1334
   206
     * First, if there is a security manager, its <code>checkWrite</code>
jtulach@1334
   207
     * method is called with the file descriptor <code>fdObj</code>
jtulach@1334
   208
     * argument as its argument.
jtulach@1334
   209
     * <p>
jtulach@1334
   210
     * If <code>fdObj</code> is null then a <code>NullPointerException</code>
jtulach@1334
   211
     * is thrown.
jtulach@1334
   212
     * <p>
jtulach@1334
   213
     * This constructor does not throw an exception if <code>fdObj</code>
jtulach@1334
   214
     * is {@link java.io.FileDescriptor#valid() invalid}.
jtulach@1334
   215
     * However, if the methods are invoked on the resulting stream to attempt
jtulach@1334
   216
     * I/O on the stream, an <code>IOException</code> is thrown.
jtulach@1334
   217
     *
jtulach@1334
   218
     * @param      fdObj   the file descriptor to be opened for writing
jtulach@1334
   219
     * @exception  SecurityException  if a security manager exists and its
jtulach@1334
   220
     *               <code>checkWrite</code> method denies
jtulach@1334
   221
     *               write access to the file descriptor
jtulach@1334
   222
     * @see        java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)
jtulach@1334
   223
     */
jtulach@1334
   224
    public FileOutputStream(FileDescriptor fdObj) {
jaroslav@1337
   225
        throw new SecurityException();
jtulach@1334
   226
    }
jtulach@1334
   227
jtulach@1334
   228
    /**
jtulach@1334
   229
     * Opens a file, with the specified name, for overwriting or appending.
jtulach@1334
   230
     * @param name name of file to be opened
jtulach@1334
   231
     * @param append whether the file is to be opened in append mode
jtulach@1334
   232
     */
jtulach@1334
   233
    private native void open(String name, boolean append)
jtulach@1334
   234
        throws FileNotFoundException;
jtulach@1334
   235
jtulach@1334
   236
    /**
jtulach@1334
   237
     * Writes the specified byte to this file output stream.
jtulach@1334
   238
     *
jtulach@1334
   239
     * @param   b   the byte to be written.
jtulach@1334
   240
     * @param   append   {@code true} if the write operation first
jtulach@1334
   241
     *     advances the position to the end of file
jtulach@1334
   242
     */
jtulach@1334
   243
    private native void write(int b, boolean append) throws IOException;
jtulach@1334
   244
jtulach@1334
   245
    /**
jtulach@1334
   246
     * Writes the specified byte to this file output stream. Implements
jtulach@1334
   247
     * the <code>write</code> method of <code>OutputStream</code>.
jtulach@1334
   248
     *
jtulach@1334
   249
     * @param      b   the byte to be written.
jtulach@1334
   250
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   251
     */
jtulach@1334
   252
    public void write(int b) throws IOException {
jtulach@1334
   253
        write(b, append);
jtulach@1334
   254
    }
jtulach@1334
   255
jtulach@1334
   256
    /**
jtulach@1334
   257
     * Writes a sub array as a sequence of bytes.
jtulach@1334
   258
     * @param b the data to be written
jtulach@1334
   259
     * @param off the start offset in the data
jtulach@1334
   260
     * @param len the number of bytes that are written
jtulach@1334
   261
     * @param append {@code true} to first advance the position to the
jtulach@1334
   262
     *     end of file
jtulach@1334
   263
     * @exception IOException If an I/O error has occurred.
jtulach@1334
   264
     */
jtulach@1334
   265
    private native void writeBytes(byte b[], int off, int len, boolean append)
jtulach@1334
   266
        throws IOException;
jtulach@1334
   267
jtulach@1334
   268
    /**
jtulach@1334
   269
     * Writes <code>b.length</code> bytes from the specified byte array
jtulach@1334
   270
     * to this file output stream.
jtulach@1334
   271
     *
jtulach@1334
   272
     * @param      b   the data.
jtulach@1334
   273
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   274
     */
jtulach@1334
   275
    public void write(byte b[]) throws IOException {
jtulach@1334
   276
        writeBytes(b, 0, b.length, append);
jtulach@1334
   277
    }
jtulach@1334
   278
jtulach@1334
   279
    /**
jtulach@1334
   280
     * Writes <code>len</code> bytes from the specified byte array
jtulach@1334
   281
     * starting at offset <code>off</code> to this file output stream.
jtulach@1334
   282
     *
jtulach@1334
   283
     * @param      b     the data.
jtulach@1334
   284
     * @param      off   the start offset in the data.
jtulach@1334
   285
     * @param      len   the number of bytes to write.
jtulach@1334
   286
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   287
     */
jtulach@1334
   288
    public void write(byte b[], int off, int len) throws IOException {
jtulach@1334
   289
        writeBytes(b, off, len, append);
jtulach@1334
   290
    }
jtulach@1334
   291
jtulach@1334
   292
    /**
jtulach@1334
   293
     * Closes this file output stream and releases any system resources
jtulach@1334
   294
     * associated with this stream. This file output stream may no longer
jtulach@1334
   295
     * be used for writing bytes.
jtulach@1334
   296
     *
jtulach@1334
   297
     * <p> If this stream has an associated channel then the channel is closed
jtulach@1334
   298
     * as well.
jtulach@1334
   299
     *
jtulach@1334
   300
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   301
     *
jtulach@1334
   302
     * @revised 1.4
jtulach@1334
   303
     * @spec JSR-51
jtulach@1334
   304
     */
jtulach@1334
   305
    public void close() throws IOException {
jtulach@1334
   306
        synchronized (closeLock) {
jtulach@1334
   307
            if (closed) {
jtulach@1334
   308
                return;
jtulach@1334
   309
            }
jtulach@1334
   310
            closed = true;
jtulach@1334
   311
        }
jaroslav@1337
   312
//
jaroslav@1337
   313
//        if (channel != null) {
jaroslav@1337
   314
//            /*
jaroslav@1337
   315
//             * Decrement FD use count associated with the channel
jaroslav@1337
   316
//             * The use count is incremented whenever a new channel
jaroslav@1337
   317
//             * is obtained from this stream.
jaroslav@1337
   318
//             */
jaroslav@1337
   319
//            fd.decrementAndGetUseCount();
jaroslav@1337
   320
//            channel.close();
jaroslav@1337
   321
//        }
jtulach@1334
   322
jtulach@1334
   323
        /*
jtulach@1334
   324
         * Decrement FD use count associated with this stream
jtulach@1334
   325
         */
jtulach@1334
   326
        int useCount = fd.decrementAndGetUseCount();
jtulach@1334
   327
jtulach@1334
   328
        /*
jtulach@1334
   329
         * If FileDescriptor is still in use by another stream, the finalizer
jtulach@1334
   330
         * will not close it.
jtulach@1334
   331
         */
jtulach@1334
   332
        if ((useCount <= 0) || !isRunningFinalize()) {
jtulach@1334
   333
            close0();
jtulach@1334
   334
        }
jtulach@1334
   335
    }
jtulach@1334
   336
jtulach@1334
   337
    /**
jtulach@1334
   338
     * Returns the file descriptor associated with this stream.
jtulach@1334
   339
     *
jtulach@1334
   340
     * @return  the <code>FileDescriptor</code> object that represents
jtulach@1334
   341
     *          the connection to the file in the file system being used
jtulach@1334
   342
     *          by this <code>FileOutputStream</code> object.
jtulach@1334
   343
     *
jtulach@1334
   344
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   345
     * @see        java.io.FileDescriptor
jtulach@1334
   346
     */
jtulach@1334
   347
     public final FileDescriptor getFD()  throws IOException {
jtulach@1334
   348
        if (fd != null) return fd;
jtulach@1334
   349
        throw new IOException();
jtulach@1334
   350
     }
jtulach@1334
   351
jtulach@1334
   352
    /**
jtulach@1334
   353
     * Returns the unique {@link java.nio.channels.FileChannel FileChannel}
jtulach@1334
   354
     * object associated with this file output stream. </p>
jtulach@1334
   355
     *
jtulach@1334
   356
     * <p> The initial {@link java.nio.channels.FileChannel#position()
jtulach@1334
   357
     * </code>position<code>} of the returned channel will be equal to the
jtulach@1334
   358
     * number of bytes written to the file so far unless this stream is in
jtulach@1334
   359
     * append mode, in which case it will be equal to the size of the file.
jtulach@1334
   360
     * Writing bytes to this stream will increment the channel's position
jtulach@1334
   361
     * accordingly.  Changing the channel's position, either explicitly or by
jtulach@1334
   362
     * writing, will change this stream's file position.
jtulach@1334
   363
     *
jtulach@1334
   364
     * @return  the file channel associated with this file output stream
jtulach@1334
   365
     *
jtulach@1334
   366
     * @since 1.4
jtulach@1334
   367
     * @spec JSR-51
jtulach@1334
   368
     */
jaroslav@1337
   369
//    public FileChannel getChannel() {
jaroslav@1337
   370
//        synchronized (this) {
jaroslav@1337
   371
//            if (channel == null) {
jaroslav@1337
   372
//                channel = FileChannelImpl.open(fd, false, true, append, this);
jaroslav@1337
   373
//
jaroslav@1337
   374
//                /*
jaroslav@1337
   375
//                 * Increment fd's use count. Invoking the channel's close()
jaroslav@1337
   376
//                 * method will result in decrementing the use count set for
jaroslav@1337
   377
//                 * the channel.
jaroslav@1337
   378
//                 */
jaroslav@1337
   379
//                fd.incrementAndGetUseCount();
jaroslav@1337
   380
//            }
jaroslav@1337
   381
//            return channel;
jaroslav@1337
   382
//        }
jaroslav@1337
   383
//    }
jtulach@1334
   384
jtulach@1334
   385
    /**
jtulach@1334
   386
     * Cleans up the connection to the file, and ensures that the
jtulach@1334
   387
     * <code>close</code> method of this file output stream is
jtulach@1334
   388
     * called when there are no more references to this stream.
jtulach@1334
   389
     *
jtulach@1334
   390
     * @exception  IOException  if an I/O error occurs.
jtulach@1334
   391
     * @see        java.io.FileInputStream#close()
jtulach@1334
   392
     */
jtulach@1334
   393
    protected void finalize() throws IOException {
jtulach@1334
   394
        if (fd != null) {
jtulach@1334
   395
            if (fd == FileDescriptor.out || fd == FileDescriptor.err) {
jtulach@1334
   396
                flush();
jtulach@1334
   397
            } else {
jtulach@1334
   398
jtulach@1334
   399
                /*
jtulach@1334
   400
                 * Finalizer should not release the FileDescriptor if another
jtulach@1334
   401
                 * stream is still using it. If the user directly invokes
jtulach@1334
   402
                 * close() then the FileDescriptor is also released.
jtulach@1334
   403
                 */
jtulach@1334
   404
                runningFinalize.set(Boolean.TRUE);
jtulach@1334
   405
                try {
jtulach@1334
   406
                    close();
jtulach@1334
   407
                } finally {
jtulach@1334
   408
                    runningFinalize.set(Boolean.FALSE);
jtulach@1334
   409
                }
jtulach@1334
   410
            }
jtulach@1334
   411
        }
jtulach@1334
   412
    }
jtulach@1334
   413
jtulach@1334
   414
    private native void close0() throws IOException;
jtulach@1334
   415
jtulach@1334
   416
    private static native void initIDs();
jtulach@1334
   417
jtulach@1334
   418
    static {
jtulach@1334
   419
        initIDs();
jtulach@1334
   420
    }
jtulach@1334
   421
jtulach@1334
   422
}