当前位置: 首页>>代码示例>>Java>>正文


Java Messages.getString方法代码示例

本文整理汇总了Java中org.apache.harmony.luni.internal.nls.Messages.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.getString方法的具体用法?Java Messages.getString怎么用?Java Messages.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.harmony.luni.internal.nls.Messages的用法示例。


在下文中一共展示了Messages.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: set

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Sets the bit at index {@code pos} to 1. Grows the {@code BitSet} if
 * {@code pos > size}.
 * 
 * @param pos
 *            the index of the bit to set.
 * @throws IndexOutOfBoundsException
 *             if {@code pos} is negative.
 * @see #clear(int)
 * @see #clear()
 * @see #clear(int, int)
 */
public void set(int pos) {
    if (pos < 0) {
        throw new IndexOutOfBoundsException(Messages.getString("luni.37")); //$NON-NLS-1$
    }

    int len = (pos >> OFFSET) + 1;
    if (len > bits.length) {
        growLength(len);
    }
    bits[len - 1] |= TWO_N_ARRAY[pos & RIGHT_BITS];
    if (len > actualArrayLength) {
        actualArrayLength = len;
        isLengthActual = true;
    }
    needClear();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:BitSet.java

示例2: getObject

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Returns the named resource from this {@code ResourceBundle}. If the
 * resource cannot be found in this bundle, it falls back to the parent
 * bundle (if it's not null) by calling the {@link #handleGetObject} method.
 * If the resource still can't be found it throws a
 * {@code MissingResourceException}.
 * 
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *             if the resource is not found.
 */
public final Object getObject(String key) {
	ResourceBundle last, theParent = this;
	do {
		Object result = theParent.handleGetObject(key);
		if (result != null) {
			return result;
		}
		last = theParent;
		theParent = theParent.parent;
	} while (theParent != null);
	throw new MissingResourceException(
			Messages.getString("luni.3A", last.getClass().getName(), key), last.getClass().getName(), key); //$NON-NLS-1$
}
 
开发者ID:cloudeecn,项目名称:fiscevm,代码行数:27,代码来源:ResourceBundle.java

示例3: readFully

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Reads bytes from this stream and stores them in the byte array {@code
 * buffer} starting at the position {@code offset}. This method blocks until
 * {@code length} bytes have been read. If {@code length} is zero, then this
 * method returns without reading any bytes.
 * 
 * @param buffer
 *            the byte array into which the data is read.
 * @param offset
 *            the offset in {@code buffer} from where to store the bytes
 *            read.
 * @param length
 *            the maximum number of bytes to read.
 * @throws EOFException
 *             if the end of the source stream is reached before enough
 *             bytes have been read.
 * @throws IndexOutOfBoundsException
 *             if {@code offset < 0} or {@code length < 0}, or if {@code
 *             offset + length} is greater than the size of {@code buffer}.
 * @throws IOException
 *             if a problem occurs while reading from this stream.
 * @throws NullPointerException
 *             if {@code buffer} or the source stream are null.
 * @see java.io.DataInput#readFully(byte[], int, int)
 */
public final void readFully(byte[] buffer, int offset, int length)
        throws IOException {
    if (length < 0) {
        throw new IndexOutOfBoundsException();
    }
    if (length == 0) {
        return;
    }
    if (in == null) {
        throw new NullPointerException(Messages.getString("luni.AA")); //$NON-NLS-1$
    }
    if (buffer == null) {
        throw new NullPointerException(Messages.getString("luni.11")); //$NON-NLS-1$
    }
    if (offset < 0 || offset > buffer.length - length) {
        throw new IndexOutOfBoundsException();
    }
    while (length > 0) {
        int result = in.read(buffer, offset, length);
        if (result < 0) {
            throw new EOFException();
        }
        offset += result;
        length -= result;
    }
}
 
开发者ID:cloudeecn,项目名称:fiscevm,代码行数:52,代码来源:DataInputStream.java

示例4: init

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
private void init(final String path, String pathActions) {
    if (pathActions == null || pathActions.equals("")) { //$NON-NLS-1$
        throw new IllegalArgumentException(Messages.getString("luni.B7")); //$NON-NLS-1$
    }
    this.actions = toCanonicalActionString(pathActions);

    if (path == null) {
        throw new NullPointerException(Messages.getString("luni.B8")); //$NON-NLS-1$
    }
    if (path.equals("<<ALL FILES>>")) { //$NON-NLS-1$
        includeAll = true;
    } else {
        canonPath = AccessController
                .doPrivileged(new PrivilegedAction<String>() {
                    public String run() {
                        try {
                            return new File(path).getCanonicalPath();
                        } catch (IOException e) {
                            return path;
                        }
                    }
                });
        if (path.equals("*") || path.endsWith(File.separator + "*")) { //$NON-NLS-1$ //$NON-NLS-2$
            allDir = true;
        }
        if (path.equals("-") || path.endsWith(File.separator + "-")) { //$NON-NLS-1$ //$NON-NLS-2$
            allSubdir = true;
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:FilePermission.java

示例5: write

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Writes {@code count} bytes from {@code buffer} starting at {@code offset}
 * to the target stream. If autoflush is set, this stream gets flushed after
 * writing the buffer.
 * <p>
 * This stream's error flag is set to {@code true} if this stream is closed
 * or an I/O error occurs.
 *
 * @param buffer
 *            the buffer to be written.
 * @param offset
 *            the index of the first byte in {@code buffer} to write.
 * @param length
 *            the number of bytes in {@code buffer} to write.
 * @throws IndexOutOfBoundsException
 *             if {@code offset < 0} or {@code count < 0}, or if {@code
 *             offset + count} is bigger than the length of {@code buffer}.
 * @see #flush()
 */
@Override
public void write(byte[] buffer, int offset, int length) {
    // Force buffer null check first!
    if (offset > buffer.length || offset < 0) {
        // luni.12=Offset out of bounds \: {0}
        throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.12", offset)); //$NON-NLS-1$
    }
    if (length < 0 || length > buffer.length - offset) {
        // luni.18=Length out of bounds \: {0}
        throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.18", length)); //$NON-NLS-1$
    }
    synchronized (this) {
        if (out == null) {
            setError();
            return;
        }
        try {
            out.write(buffer, offset, length);
            if (autoflush) {
                flush();
            }
        } catch (IOException e) {
            setError();
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:46,代码来源:PrintStream.java

示例6: read

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Reads a single byte from this stream and returns it as an integer in the
 * range from 0 to 255. Returns -1 if the end of the source string has been
 * reached. If the internal buffer does not contain any available bytes then
 * it is filled from the source stream and the first byte is returned.
 * 
 * @return the byte read or -1 if the end of the source stream has been
 *         reached.
 * @throws IOException
 *             if this stream is closed or another IOException occurs.
 */
@Override
public synchronized int read() throws IOException {
    // Use local refs since buf and in may be invalidated by an
    // unsynchronized close()
    byte[] localBuf = buf;
    InputStream localIn = in;
    if (localBuf == null || localIn == null) {
        // luni.24=Stream is closed
        throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
    }

    /* Are there buffered bytes available? */
    if (pos >= count && fillbuf(localIn, localBuf) == -1) {
        return -1; /* no, fill buffer */
    }
    // localBuf may have been invalidated by fillbuf
    if (localBuf != buf) {
        localBuf = buf;
        if (localBuf == null) {
            // luni.24=Stream is closed
            throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
        }
    }

    /* Did filling the buffer fail with -1 (EOF)? */
    if (count - pos > 0) {
        return localBuf[pos++] & 0xFF;
    }
    return -1;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:42,代码来源:BufferedInputStream.java

示例7: setURLStreamHandlerFactory

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Sets the {@code URLStreamHandlerFactory} which creates protocol specific
 * stream handlers. This method can be invoked only once during an
 * application's lifetime. If the {@code URLStreamHandlerFactory} is already
 * set an {@link Error} will be thrown.
 * <p>
 * A security check is performed to verify whether the current policy allows
 * to set the stream handler factory.
 *
 * @param streamFactory
 *            the factory to be used for creating stream protocol handlers.
 */
public static synchronized void setURLStreamHandlerFactory(
        URLStreamHandlerFactory streamFactory) {
    if (streamHandlerFactory != null) {
        throw new Error(Messages.getString("luni.9A")); //$NON-NLS-1$
    }
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkSetFactory();
    }
    streamHandlers.clear();
    streamHandlerFactory = streamFactory;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:URL.java

示例8: Scanner

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Creates a {@code Scanner} with the specified {@code ReadableByteChannel} as
 * input. The specified charset is applied when decoding the input.
 * 
 * @param src
 *            the {@code ReadableByteChannel} to be scanned.
 * @param charsetName
 *            the encoding type of the content.
 * @throws IllegalArgumentException
 *             if the specified character set is not found.
 */
public Scanner(ReadableByteChannel src, String charsetName) {
    if (null == src) {
        throw new NullPointerException(Messages
                .getString("luni.DD")); //$NON-NLS-1$
    }
    if (null == charsetName) {
        throw new IllegalArgumentException(Messages
                .getString("luni.DC")); //$NON-NLS-1$
    }
    input = Channels.newReader(src, charsetName);
    initialization();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:Scanner.java

示例9: validateSimple

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
static void validateSimple(String s, String legal)
        throws URISyntaxException {
    for (int i = 0; i < s.length();) {
        char ch = s.charAt(i);
        if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
                || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) {
            throw new URISyntaxException(s, Messages.getString("luni.7F"), i); //$NON-NLS-1$
        }
        i++;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:URIEncoderDecoder.java

示例10: write

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Writes {@code count} bytes from the byte array {@code buffer} starting at
 * {@code offset} to this stream. If there is room in the buffer to hold the
 * bytes, they are copied in. If not, the buffered bytes plus the bytes in
 * {@code buffer} are written to the target stream, the target is flushed,
 * and the buffer is cleared.
 * 
 * @param buffer
 *            the buffer to be written.
 * @param offset
 *            the start position in {@code buffer} from where to get bytes.
 * @param length
 *            the number of bytes from {@code buffer} to write to this
 *            stream.
 * @throws IndexOutOfBoundsException
 *             if {@code offset < 0} or {@code length < 0}, or if
 *             {@code offset + length} is greater than the size of
 *             {@code buffer}.
 * @throws IOException
 *             if an error occurs attempting to write to this stream.
 * @throws NullPointerException
 *             if {@code buffer} is {@code null}.
 * @throws ArrayIndexOutOfBoundsException
 *             If offset or count is outside of bounds.
 */
@Override
public synchronized void write(byte[] buffer, int offset, int length)
        throws IOException {
    byte[] internalBuffer = buf;

    if (internalBuffer != null && length >= internalBuffer.length) {
        flushInternal();
        out.write(buffer, offset, length);
        return;
    }

    if (buffer == null) {
        // luni.11=buffer is null
        throw new NullPointerException(Messages.getString("luni.11")); //$NON-NLS-1$
    }
    
    if (offset < 0 || offset > buffer.length - length) {
        // luni.12=Offset out of bounds \: {0}
        throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.12", offset)); //$NON-NLS-1$
    
    }
    if (length < 0) {
        // luni.18=Length out of bounds \: {0}
        throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.18", length)); //$NON-NLS-1$
    }

    if (internalBuffer == null) {
        throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
    }

    // flush the internal buffer first if we have not enough space left
    if (length >= (internalBuffer.length - count)) {
        flushInternal();
    }

    // the length is always less than (internalBuffer.length - count) here so arraycopy is safe
    System.arraycopy(buffer, offset, internalBuffer, count, length);
    count += length;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:65,代码来源:BufferedOutputStream.java

示例11: validateFragment

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
private void validateFragment(String uri, String fragment, int index)
        throws URISyntaxException {
    try {
        URIEncoderDecoder.validate(fragment, allLegal);
    } catch (URISyntaxException e) {
        throw new URISyntaxException(uri, Messages.getString("luni.8A", e //$NON-NLS-1$
                .getReason()), index + e.getIndex());
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:URI.java

示例12: URI

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Creates a new URI instance using the given arguments. This constructor
 * first creates a temporary URI string from the given components. This
 * string will be parsed later on to create the URI instance.
 * <p>
 * {@code [scheme:][//authority][path][?query][#fragment]}
 *
 * @param scheme
 *            the scheme part of the URI.
 * @param authority
 *            the authority part of the URI.
 * @param path
 *            the path to the resource on the host.
 * @param query
 *            the query part of the URI to specify parameters for the
 *            resource.
 * @param fragment
 *            the fragment part of the URI.
 * @throws URISyntaxException
 *             if the temporary created string doesn't fit to the
 *             specification RFC2396 or could not be parsed correctly.
 */
public URI(String scheme, String authority, String path, String query,
        String fragment) throws URISyntaxException {
    if (scheme != null && path != null && path.length() > 0
            && path.charAt(0) != '/') {
        throw new URISyntaxException(path, Messages.getString("luni.82")); //$NON-NLS-1$
    }

    StringBuilder uri = new StringBuilder();
    if (scheme != null) {
        uri.append(scheme);
        uri.append(':');
    }
    if (authority != null) {
        uri.append("//"); //$NON-NLS-1$
        // QUOTE ILLEGAL CHARS
        uri.append(quoteComponent(authority, "@[]" + someLegal)); //$NON-NLS-1$
    }

    if (path != null) {
        // QUOTE ILLEGAL CHARS
        uri.append(quoteComponent(path, "/@" + someLegal)); //$NON-NLS-1$
    }
    if (query != null) {
        // QUOTE ILLEGAL CHARS
        uri.append('?');
        uri.append(quoteComponent(query, allLegal));
    }
    if (fragment != null) {
        // QUOTE ILLEGAL CHARS
        uri.append('#');
        uri.append(quoteComponent(fragment, allLegal));
    }

    new Helper().parseURI(uri.toString(), false);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:58,代码来源:URI.java

示例13: bind

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Binds this socket to the given local host address and port specified by
 * the SocketAddress {@code localAddr}. If {@code localAddr} is set to
 * {@code null}, this socket will be bound to an available local address on
 * any free port.
 * 
 * @param localAddr
 *            the specific address and port on the local machine to bind to.
 * @throws IllegalArgumentException
 *             if the given SocketAddress is invalid or not supported.
 * @throws IOException
 *             if the socket is already bound or an error occurs while
 *             binding.
 */
public void bind(SocketAddress localAddr) throws IOException {
    checkClosedAndCreate(true);
    if (isBound()) {
        throw new BindException(Messages.getString("luni.71")); //$NON-NLS-1$
    }

    int port = 0;
    InetAddress addr = InetAddress.ANY;
    if (localAddr != null) {
        if (!(localAddr instanceof InetSocketAddress)) {
            throw new IllegalArgumentException(Messages.getString(
                    "luni.49", localAddr.getClass())); //$NON-NLS-1$
        }
        InetSocketAddress inetAddr = (InetSocketAddress) localAddr;
        if ((addr = inetAddr.getAddress()) == null) {
            throw new SocketException(Messages.getString(
                    "luni.1A", inetAddr.getHostName())); //$NON-NLS-1$
        }
        port = inetAddr.getPort();
    }

    synchronized (this) {
        try {
            impl.bind(addr, port);
            isBound = true;
        } catch (IOException e) {
            impl.close();
            throw e;
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:46,代码来源:Socket.java

示例14: setPort

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Sets the port number of the target host of this datagram packet.
 * 
 * @param aPort
 *            the target host port number.
 */
public synchronized void setPort(int aPort) {
    if (aPort < 0 || aPort > 65535) {
        throw new IllegalArgumentException(Messages.getString("luni.56", aPort)); //$NON-NLS-1$
    }
    port = aPort;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:DatagramPacket.java

示例15: getBundle

import org.apache.harmony.luni.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Finds the named resource bundle for the specified {@code Locale} and
 * {@code ClassLoader}.
 * 
 * The passed base name and {@code Locale} are used to create resource
 * bundle names. The first name is created by concatenating the base name
 * with the result of {@link Locale#toString()}. From this name all parent
 * bundle names are derived. Then the same thing is done for the default
 * {@code Locale}. This results in a list of possible bundle names.
 * 
 * <strong>Example</strong> For the basename "BaseName", the {@code Locale}
 * of the German part of Switzerland (de_CH) and the default {@code Locale}
 * en_US the list would look something like this:
 * 
 * <ol>
 * <li>BaseName_de_CH</li>
 * <li>BaseName_de</li>
 * <li>Basename_en_US</li>
 * <li>Basename_en</li>
 * <li>BaseName</li>
 * </ol>
 * 
 * This list also shows the order in which the bundles will be searched for
 * a requested resource in the German part of Switzerland (de_CH).
 * 
 * As a first step, this method tries to instantiate a
 * {@code ResourceBundle} with the names provided. If such a class can be
 * instantiated and initialized, it is returned and all the parent bundles
 * are instantiated too. If no such class can be found this method tries to
 * load a {@code .properties} file with the names by replacing dots in the
 * base name with a slash and by appending "{@code .properties}" at the end
 * of the string. If such a resource can be found by calling
 * {@link ClassLoader#getResource(String)} it is used to initialize a
 * {@link PropertyResourceBundle}. If this succeeds, it will also load the
 * parents of this {@code ResourceBundle}.
 * 
 * For compatibility with older code, the bundle name isn't required to be a
 * fully qualified class name. It's also possible to directly pass the path
 * to a properties file (without a file extension).
 * 
 * @param bundleName
 *            the name of the {@code ResourceBundle}.
 * @param locale
 *            the {@code Locale}.
 * @param loader
 *            the {@code ClassLoader} to use.
 * @return the requested {@code ResourceBundle}.
 * @throws MissingResourceException
 *             if the {@code ResourceBundle} cannot be found.
 */
public static ResourceBundle getBundle(String bundleName, Locale locale,
		ClassLoader loader) throws MissingResourceException {
	if (loader == null) {
		throw new NullPointerException();
	}
	if (bundleName != null) {
		ResourceBundle bundle;
		if (!locale.equals(Locale.getDefault())) {
			if ((bundle = handleGetBundle(bundleName, UNDER_SCORE + locale,
					false, loader)) != null) {
				return bundle;
			}
		}
		if ((bundle = handleGetBundle(bundleName,
				UNDER_SCORE + Locale.getDefault(), true, loader)) != null) {
			return bundle;
		}
		throw new MissingResourceException(Messages.getString(
				"luni.3A", bundleName, locale), bundleName + '_' + locale, //$NON-NLS-1$
				EMPTY_STRING);
	}
	throw new NullPointerException();
}
 
开发者ID:cloudeecn,项目名称:fiscevm,代码行数:74,代码来源:ResourceBundle.java


注:本文中的org.apache.harmony.luni.internal.nls.Messages.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。