本文整理汇总了Java中org.apache.harmony.luni.internal.nls.Messages类的典型用法代码示例。如果您正苦于以下问题:Java Messages类的具体用法?Java Messages怎么用?Java Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Messages类属于org.apache.harmony.luni.internal.nls包,在下文中一共展示了Messages类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cd
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Change the server directory to that specified in the URL
*/
private void cd() throws IOException {
int idx = url.getFile().lastIndexOf('/');
if (idx > 0) {
String dir = url.getFile().substring(0, idx);
write("CWD " + dir + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
int reply = getReply();
if (reply != FTP_FILEOK && dir.length() > 0 && dir.charAt(0) == '/') {
write("CWD " + dir.substring(1) + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
reply = getReply();
}
if (reply != FTP_FILEOK) {
throw new IOException(Messages.getString("luni.1C")); //$NON-NLS-1$
}
}
}
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:FtpURLConnection.java
示例2: read
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Reads at most {@code count} characters from this CharArrayReader and
* stores them at {@code offset} in the character array {@code buf}.
* Returns the number of characters actually read or -1 if the end of reader
* was encountered.
*
* @param buffer
* the character array to store the characters read.
* @param offset
* the initial position in {@code buffer} to store the characters
* read from this reader.
* @param len
* the maximum number of characters to read.
* @return number of characters read or -1 if the end of the reader has been
* reached.
* @throws IndexOutOfBoundsException
* if {@code offset < 0} or {@code len < 0}, or if
* {@code offset + len} is bigger than the size of
* {@code buffer}.
* @throws IOException
* if this reader is closed.
*/
@Override
public int read(char buffer[], int offset, int len) throws IOException {
if (offset < 0 || offset > buffer.length) {
// luni.12=Offset out of bounds \: {0}
throw new ArrayIndexOutOfBoundsException(
Messages.getString("luni.12", offset)); //$NON-NLS-1$
}
if (len < 0 || len > buffer.length - offset) {
// luni.18=Length out of bounds \: {0}
throw new ArrayIndexOutOfBoundsException(
Messages.getString("luni.18", len)); //$NON-NLS-1$
}
synchronized (lock) {
if (isClosed()) {
throw new IOException(Messages.getString("luni.A9")); //$NON-NLS-1$
}
if (pos < this.count) {
int bytesRead = pos + len > this.count ? this.count - pos : len;
System.arraycopy(this.buf, pos, buffer, offset, bytesRead);
pos += bytesRead;
return bytesRead;
}
return -1;
}
}
开发者ID:shannah,项目名称:cn1,代码行数:48,代码来源:CharArrayReader.java
示例3: getInputStream
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Creates an input stream for reading from this URL Connection.
*
* @return the input stream
*
* @throws IOException
* if an IO error occurs while connecting to the resource.
*/
@Override
public InputStream getInputStream() throws IOException {
if (closed) {
// luni.33=Inputstream of the JarURLConnection has been closed
throw new IllegalStateException(Messages.getString("luni.33")); //$NON-NLS-1$
}
connect();
if (jarInput != null) {
return jarInput;
}
if (jarEntry == null) {
// luni.34=Jar entry not specified
throw new IOException(Messages.getString("luni.34")); //$NON-NLS-1$
}
return jarInput = new JarURLConnectionInputStream(jarFile
.getInputStream(jarEntry), jarFile);
}
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:JarURLConnectionImpl.java
示例4: FileInputStream
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Constructs a new {@code FileInputStream} based on {@code file}.
*
* @param file
* the file from which this stream reads.
* @throws FileNotFoundException
* if {@code file} does not exist.
* @throws SecurityException
* if a {@code SecurityManager} is installed and it denies the
* read request.
*/
public FileInputStream(File file) throws FileNotFoundException {
super();
SecurityManager security = System.getSecurityManager();
if (security != null) {
// For compatibility, nulls are passed to the manager.
String filePath = (null == file ? null : file.getPath());
security.checkRead(filePath);
}
if (file == null) {
// luni.4D=Argument must not be null
throw new NullPointerException(Messages.getString("luni.4D")); //$NON-NLS-1$
}
fd = new FileDescriptor();
fd.readOnly = true;
fd.descriptor = fileSystem.open(file.properPath(true),
IFileSystem.O_RDONLY);
innerFD = true;
channel = FileChannelFactory.getFileChannel(this, fd.descriptor,
IFileSystem.O_RDONLY);
}
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:FileInputStream.java
示例5: Scanner
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Creates a {@code Scanner} with the specified {@code File} as input. The specified charset
* is applied when reading the file.
*
* @param src
* the file to be scanned.
* @param charsetName
* the name of the encoding type of the file.
* @throws FileNotFoundException
* if the specified file does not exist.
* @throws IllegalArgumentException
* if the specified coding does not exist.
*/
public Scanner(File src, String charsetName) throws FileNotFoundException {
if (null == src) {
throw new NullPointerException(Messages
.getString("luni.DB")); //$NON-NLS-1$
}
FileInputStream fis = new FileInputStream(src);
if (null == charsetName) {
throw new IllegalArgumentException(Messages
.getString("luni.DC")); //$NON-NLS-1$
}
try {
input = new InputStreamReader(fis, charsetName);
} catch (UnsupportedEncodingException e) {
try {
fis.close();
} catch (IOException ioException) {
// ignore
}
throw new IllegalArgumentException(e.getMessage());
}
initialization();
}
开发者ID:shannah,项目名称:cn1,代码行数:36,代码来源:Scanner.java
示例6: openConnection
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* The behaviour of this method is the same as openConnection(URL).
* <code>proxy</code> is not used in FileURLConnection.
*
* @param url
* the URL which the connection is pointing to
* @param proxy
* Proxy
* @return a connection to the resource pointed by this url.
*
* @throws IOException
* if this handler fails to establish a connection.
* @throws IllegalArgumentException
* if the url argument is null.
* @throws UnsupportedOperationException
* if the protocol handler doesn't support this method.
*/
@Override
public URLConnection openConnection(URL url, Proxy proxy)
throws IOException {
if (null == url) {
// luni.1B=url and proxy can not be null
throw new IllegalArgumentException(Messages.getString("luni.1B")); //$NON-NLS-1$
}
String host = url.getHost();
if (host == null || host.length() == 0
|| host.equalsIgnoreCase("localhost")) { //$NON-NLS-1$
return new FileURLConnection(url);
}
// If a hostname is specified try to get the resource using FTP
URL ftpURL = new URL("ftp", host, url.getFile()); //$NON-NLS-1$
return (proxy == null) ? ftpURL.openConnection() : ftpURL
.openConnection(proxy);
}
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:Handler.java
示例7: write
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
@Override
public synchronized void write(int data) throws IOException {
if (closed) {
throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
}
if (limit >= 0) {
if (limit == 0) {
throw new IOException(Messages.getString("luni.26")); //$NON-NLS-1$
}
limit--;
}
cache.write(data);
if (writeToSocket && cache.size() >= cacheLength) {
sendCache(false);
}
}
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:HttpURLConnectionImpl.java
示例8: readClassDesc
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Reads a class descriptor (an {@code ObjectStreamClass}) from the
* stream.
*
* @return the class descriptor read from the stream
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If the class corresponding to the class descriptor could not
* be found.
*/
private ObjectStreamClass readClassDesc() throws ClassNotFoundException,
IOException {
byte tc = nextTC();
switch (tc) {
case TC_CLASSDESC:
return readNewClassDesc(false);
case TC_PROXYCLASSDESC:
Class<?> proxyClass = readNewProxyClassDesc();
ObjectStreamClass streamClass = ObjectStreamClass
.lookup(proxyClass);
streamClass.setLoadFields(new ObjectStreamField[0]);
registerObjectRead(streamClass, nextHandle(), false);
checkedSetSuperClassDesc(streamClass, readClassDesc());
return streamClass;
case TC_REFERENCE:
return (ObjectStreamClass) readCyclicReference();
case TC_NULL:
return null;
default:
throw new StreamCorruptedException(Messages.getString(
"luni.BC", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
}
}
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:ObjectInputStream.java
示例9: login
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
private void login() throws IOException {
int reply;
reply = getReply();
if (reply == FTP_USERREADY) {
} else {
throw new IOException(Messages.getString("luni.1D", url.getHost())); //$NON-NLS-1$
}
write("USER " + username + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
reply = getReply();
if (reply == FTP_PASWD || reply == FTP_LOGGEDIN) {
} else {
throw new IOException(Messages.getString("luni.20", url.getHost())); //$NON-NLS-1$
}
if (reply == FTP_PASWD) {
write("PASS " + password + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
reply = getReply();
if (!(reply == FTP_OK || reply == FTP_USERREADY || reply == FTP_LOGGEDIN)) {
throw new IOException(Messages.getString("luni.20", url.getHost())); //$NON-NLS-1$
}
}
}
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:FtpURLConnection.java
示例10: createNewFile
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Creates a new, empty file on the file system according to the path
* information stored in this file.
*
* @return {@code true} if the file has been created, {@code false} if it
* already exists.
* @throws IOException
* if an I/O error occurs or the directory does not exist where
* the file should have been created.
* @throws SecurityException
* if a {@code SecurityManager} is installed and it denies write
* access for this file.
*/
public boolean createNewFile() throws IOException {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
if (0 == path.length()) {
throw new IOException(Messages.getString("luni.B3")); //$NON-NLS-1$
}
int result = newFileImpl(properPath(true));
switch (result) {
case 0:
return true;
case 1:
return false;
default:
throw new IOException(Messages.getString("luni.B4", path)); //$NON-NLS-1$
}
}
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:File.java
示例11: setProxy
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
private void setProxy(String proxy) {
int index = proxy.indexOf(':');
if (index == -1) {
proxyName = proxy;
hostPort = defaultPort;
} else {
proxyName = proxy.substring(0, index);
String port = proxy.substring(index + 1);
try {
hostPort = Integer.parseInt(port);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(Messages.getString("luni.30", port)); //$NON-NLS-1$
}
if (hostPort < 0 || hostPort > 65535) {
throw new IllegalArgumentException(Messages.getString("luni.31")); //$NON-NLS-1$
}
}
}
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:HttpURLConnectionImpl.java
示例12: bind
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Binds this socket to the local address and port specified by {@code
* localAddr}. If this value is {@code null} any free port on a valid local
* address is used.
*
* @param localAddr
* the local machine address and port to bind on.
* @throws IllegalArgumentException
* if the SocketAddress is not supported
* @throws SocketException
* if the socket is already bound or a problem occurs during
* binding.
*/
public void bind(SocketAddress localAddr) throws SocketException {
checkClosedAndBind(false);
int localPort = 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;
addr = inetAddr.getAddress();
if (addr == null) {
throw new SocketException(Messages.getString(
"luni.1A", inetAddr.getHostName())); //$NON-NLS-1$
}
localPort = inetAddr.getPort();
checkListen(localPort);
}
impl.bind(localPort, addr);
isBound = true;
}
开发者ID:shannah,项目名称:cn1,代码行数:35,代码来源:DatagramSocket.java
示例13: connect
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Connects this stream to a {@link PipedInputStream}. Any data written to
* this output stream becomes readable in the input stream.
*
* @param stream
* the destination input stream.
* @throws IOException
* if either stream is already connected.
*/
public void connect(PipedInputStream stream) throws IOException {
if (null == stream) {
throw new NullPointerException();
}
if (this.dest != null) {
throw new IOException(Messages.getString("luni.5F")); //$NON-NLS-1$
}
synchronized (stream) {
if (stream.isConnected) {
throw new IOException(Messages.getString("luni.D0")); //$NON-NLS-1$
}
if (stream.buffer == null) {
stream.buffer = new byte[PipedInputStream.PIPE_SIZE];
}
stream.isConnected = true;
this.dest = stream;
}
}
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:PipedOutputStream.java
示例14: makeNewHandler
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
private synchronized void makeNewHandler() {
while (!searchList.isEmpty()) {
URL nextCandidate = searchList.remove(0);
if (nextCandidate == null) { // luni.94=One of urls is null
throw new NullPointerException(Messages.getString("luni.94")); //$NON-NLS-1$
}
if (!handlerMap.containsKey(nextCandidate)) {
URLHandler result;
String protocol = nextCandidate.getProtocol();
if (protocol.equals("jar")) { //$NON-NLS-1$
result = createURLJarHandler(nextCandidate);
} else if (protocol.equals("file")) { //$NON-NLS-1$
result = createURLFileHandler(nextCandidate);
} else {
result = createURLHandler(nextCandidate);
}
if (result != null) {
handlerMap.put(nextCandidate, result);
handlerList.add(result);
return;
}
}
}
}
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:URLClassLoader.java
示例15: read
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
@Override
public int read(byte[] buffer, int offset, int nbytes) throws IOException {
synchronized (this) {
if (handle == -1) {
return -1;
}
if (nbytes > buffer.length || nbytes < 0) {
// luni.18=Length out of bounds \: {0}
throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.18", nbytes)); //$NON-NLS-1$
}
if (offset < 0 || offset > buffer.length - nbytes) {
// luni.12=Offset out of bounds \: {0}
throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.12", offset)); //$NON-NLS-1$
}
return readImpl(buffer, offset, nbytes, handle);
}
}
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:ProcessInputStream.java
示例16: 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
示例17: 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
示例18: joinGroup
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Adds this socket to the specified multicast group. A socket must join a
* group before data may be received. A socket may be a member of multiple
* groups but may join any group only once.
*
* @param groupAddress
* the multicast group to be joined.
* @param netInterface
* the network interface on which the datagram packets will be
* received.
* @throws IOException
* if the specified address is not a multicast address.
* @throws SecurityException
* if the caller is not authorized to join the group.
* @throws IllegalArgumentException
* if no multicast group is specified.
* @since 1.4
*/
public void joinGroup(SocketAddress groupAddress,
NetworkInterface netInterface) throws IOException {
checkClosedAndBind(false);
if (null == groupAddress) {
throw new IllegalArgumentException(Messages.getString("luni.5D")); //$NON-NLS-1$
}
if ((netInterface != null) && (netInterface.getFirstAddress() == null)) {
// this is ok if we could set it at the
throw new SocketException(Messages.getString("luni.67")); //$NON-NLS-1$
}
if (!(groupAddress instanceof InetSocketAddress)) {
throw new IllegalArgumentException(Messages.getString(
"luni.49", groupAddress.getClass())); //$NON-NLS-1$
}
InetAddress groupAddr = ((InetSocketAddress) groupAddress).getAddress();
if (groupAddr == null) {
throw new SocketException(Messages.getString("luni.68")); //$NON-NLS-1$
}
if (!groupAddr.isMulticastAddress()) {
throw new IOException(Messages.getString("luni.66")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkMulticast(groupAddr);
}
impl.joinGroup(groupAddress, netInterface);
}
开发者ID:shannah,项目名称:cn1,代码行数:52,代码来源:MulticastSocket.java
示例19: setRequestProperty
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
@Override
public void setRequestProperty(String field, String newValue) {
if (connected) {
throw new IllegalStateException(Messages.getString("luni.2C")); //$NON-NLS-1$
}
if (field == null) {
throw new NullPointerException();
}
reqHeader.set(field, newValue);
}
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:HttpURLConnectionImpl.java
示例20: write
import org.apache.harmony.luni.internal.nls.Messages; //导入依赖的package包/类
/**
* Writes {@code count} characters starting at {@code offset} in
* {@code cbuf} to this writer. If {@code count} is greater than this
* writer's buffer, then the buffer is flushed and the characters are
* written directly to the target writer.
*
* @param cbuf
* the array containing characters to write.
* @param offset
* the start position in {@code cbuf} for retrieving characters.
* @param count
* the maximum number of characters to write.
* @throws IndexOutOfBoundsException
* if {@code offset < 0} or {@code count < 0}, or if
* {@code offset + count} is greater than the size of
* {@code cbuf}.
* @throws IOException
* if this writer is closed or another I/O error occurs.
*/
@Override
public void write(char[] cbuf, int offset, int count) throws IOException {
synchronized (lock) {
if (isClosed()) {
throw new IOException(Messages.getString("luni.A7")); //$NON-NLS-1$
}
if (offset < 0 || offset > cbuf.length - count || count < 0) {
throw new IndexOutOfBoundsException();
}
if (pos == 0 && count >= this.buf.length) {
out.write(cbuf, offset, count);
return;
}
int available = this.buf.length - pos;
if (count < available) {
available = count;
}
if (available > 0) {
System.arraycopy(cbuf, offset, this.buf, pos, available);
pos += available;
}
if (pos == this.buf.length) {
out.write(this.buf, 0, this.buf.length);
pos = 0;
if (count > available) {
offset += available;
available = count - available;
if (available >= this.buf.length) {
out.write(cbuf, offset, available);
return;
}
System.arraycopy(cbuf, offset, this.buf, pos, available);
pos += available;
}
}
}
}
开发者ID:shannah,项目名称:cn1,代码行数:58,代码来源:BufferedWriter.java
注:本文中的org.apache.harmony.luni.internal.nls.Messages类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论