mirror of https://github.com/sipwise/jitsi.git
parent
eaae152bd4
commit
4e95d37ce1
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.protocol.msn;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.util.*;
|
||||
|
||||
/**
|
||||
* The Resources class manages the access to the internationalization
|
||||
* properties files.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class Resources
|
||||
{
|
||||
|
||||
/**
|
||||
* Logger for this class.
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(Resources.class);
|
||||
|
||||
/**
|
||||
* Name of the bundle were we will search for localized string.
|
||||
*/
|
||||
private static final String BUNDLE_NAME
|
||||
= "net.java.sip.communicator.impl.protocol.msn.resources";
|
||||
|
||||
/**
|
||||
* Bundle which handle access to localized resources.
|
||||
*/
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
|
||||
/**
|
||||
* Returns an internationalized string corresponding to the given key.
|
||||
*
|
||||
* @param key The key of the string.
|
||||
*
|
||||
* @return An internationalized string corresponding to the given key.
|
||||
*/
|
||||
public static String getString(String key)
|
||||
{
|
||||
try
|
||||
{
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
|
||||
}
|
||||
catch (MissingResourceException e) {
|
||||
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Base64InputStream.java
|
||||
* Copyright(C) 2002 The Free Software Foundation
|
||||
*
|
||||
* This file is part of GNU JavaMail, a library.
|
||||
*
|
||||
* GNU JavaMail is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
*(at your option) any later version.
|
||||
*
|
||||
* GNU JavaMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* As a special exception, if you link this library with other files to
|
||||
* produce an executable, this library does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* This exception does not however invalidate any other reasons why the
|
||||
* executable file might be covered by the GNU General Public License.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.protocol.msn.mail.utils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* A Base64 content transfer encoding filter stream.
|
||||
* <p>
|
||||
* From RFC 2045, section 6.8:
|
||||
* <p>
|
||||
* The Base64 Content-Transfer-Encoding is designed to represent
|
||||
* arbitrary sequences of octets in a form that need not be humanly
|
||||
* readable. The encoding and decoding algorithms are simple, but the
|
||||
* encoded data are consistently only about 33 percent larger than the
|
||||
* unencoded data.
|
||||
*
|
||||
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a>
|
||||
*/
|
||||
public class Base64InputStream
|
||||
extends FilterInputStream
|
||||
{
|
||||
|
||||
private byte[] buffer;
|
||||
private int buflen;
|
||||
private int index;
|
||||
private byte[] decodeBuf;
|
||||
|
||||
private static final char[] src =
|
||||
{
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
|
||||
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
||||
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', '+', '/'
|
||||
};
|
||||
private static final byte[] dst;
|
||||
|
||||
private static final int LF = 10, CR = 13, EQ = 61;
|
||||
|
||||
static
|
||||
{
|
||||
dst = new byte[256];
|
||||
for (int i = 0; i<255; i++)
|
||||
dst[i] = -1;
|
||||
for (int i = 0; i<src.length; i++)
|
||||
dst[src[i]] = (byte)i;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an input stream that decodes an underlying Base64-encoded
|
||||
* stream.
|
||||
* @param in the Base64-encoded stream
|
||||
*/
|
||||
public Base64InputStream(InputStream in)
|
||||
{
|
||||
super(in);
|
||||
decodeBuf = new byte[4];
|
||||
buffer = new byte[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next byte of data from the input stream.
|
||||
*/
|
||||
public int read()
|
||||
throws IOException
|
||||
{
|
||||
if (index>=buflen)
|
||||
{
|
||||
decode();
|
||||
if (buflen==0)
|
||||
return -1;
|
||||
index = 0;
|
||||
}
|
||||
return buffer[index++] & 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads up to len bytes of data from the input stream into an array of
|
||||
* bytes.
|
||||
*/
|
||||
public int read(byte[] b, int off, int len)
|
||||
throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
int l = 0;
|
||||
for (; l<len; l++)
|
||||
{
|
||||
int c;
|
||||
if ((c=read())==-1)
|
||||
{
|
||||
if (l==0)
|
||||
l = -1;
|
||||
break;
|
||||
}
|
||||
b[off+l] = (byte)c;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes that can be read(or skipped over) from this
|
||||
* input stream without blocking by the next caller of a method for this
|
||||
* input stream.
|
||||
*/
|
||||
public int available()
|
||||
throws IOException
|
||||
{
|
||||
return (in.available()*3)/4+(buflen-index);
|
||||
}
|
||||
|
||||
private void decode()
|
||||
throws IOException
|
||||
{
|
||||
buflen = 0;
|
||||
int c;
|
||||
do
|
||||
{
|
||||
c = in.read();
|
||||
if (c==-1)
|
||||
return;
|
||||
}
|
||||
while (c==LF || c==CR);
|
||||
decodeBuf[0] = (byte)c;
|
||||
int j = 3, l;
|
||||
for (int k=1;(l=in.read(decodeBuf, k, j))!=j; k += l)
|
||||
{
|
||||
if (l==-1)
|
||||
throw new IOException("Base64 encoding error");
|
||||
j -= l;
|
||||
}
|
||||
|
||||
byte b0 = dst[decodeBuf[0] & 0xff];
|
||||
byte b2 = dst[decodeBuf[1] & 0xff];
|
||||
buffer[buflen++] = (byte)(b0<<2 & 0xfc | b2>>>4 & 0x3);
|
||||
if (decodeBuf[2]!=EQ)
|
||||
{
|
||||
b0 = b2;
|
||||
b2 = dst[decodeBuf[2] & 0xff];
|
||||
buffer[buflen++] = (byte)(b0<<4 & 0xf0 | b2>>>2 & 0xf);
|
||||
if (decodeBuf[3]!=EQ)
|
||||
{
|
||||
b0 = b2;
|
||||
b2 = dst[decodeBuf[3] & 0xff];
|
||||
buffer[buflen++] = (byte)(b0<<6 & 0xc0 | b2 & 0x3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* MimeUtility.java
|
||||
* Copyright (C) 2002, 2004, 2005 The Free Software Foundation
|
||||
*
|
||||
* This file is part of GNU JavaMail, a library.
|
||||
*
|
||||
* GNU JavaMail is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNU JavaMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* As a special exception, if you link this library with other files to
|
||||
* produce an executable, this library does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* This exception does not however invalidate any other reasons why the
|
||||
* executable file might be covered by the GNU General Public License.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.protocol.msn.mail.utils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* This is a utility class providing micellaneous MIME-related functionality.
|
||||
*
|
||||
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a>
|
||||
* @version 1.4
|
||||
*/
|
||||
public class MimeUtility
|
||||
{
|
||||
|
||||
/*
|
||||
* Uninstantiable.
|
||||
*/
|
||||
private MimeUtility()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes headers that are defined as '*text' in RFC 822.
|
||||
* @param etext the possibly encoded value
|
||||
* @exception UnsupportedEncodingException if the charset conversion failed
|
||||
*/
|
||||
public static String decodeText(String etext)
|
||||
throws UnsupportedEncodingException
|
||||
{
|
||||
String delimiters = "\t\n\r ";
|
||||
if (etext.indexOf("=?") == -1)
|
||||
{
|
||||
return etext;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(etext, delimiters, true);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuffer extra = new StringBuffer();
|
||||
boolean decoded = false;
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
String token = st.nextToken();
|
||||
char c = token.charAt(0);
|
||||
if (delimiters.indexOf(c) > -1)
|
||||
{
|
||||
extra.append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
token = decodeWord(token);
|
||||
if (!decoded && extra.length() > 0)
|
||||
{
|
||||
buffer.append(extra);
|
||||
}
|
||||
decoded = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (extra.length() > 0)
|
||||
{
|
||||
buffer.append(extra);
|
||||
}
|
||||
decoded = false;
|
||||
}
|
||||
buffer.append(token);
|
||||
extra.setLength(0);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the specified string using the RFC 2047 rules for parsing an
|
||||
* "encoded-word".
|
||||
* @param eword the possibly encoded value
|
||||
* @exception Exception if the string is not an encoded-word
|
||||
* @exception UnsupportedEncodingException if the decoding failed
|
||||
*/
|
||||
public static String decodeWord(String text)
|
||||
throws Exception, UnsupportedEncodingException
|
||||
{
|
||||
if (!text.startsWith("=?"))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
int start = 2;
|
||||
int end = text.indexOf('?', start);
|
||||
if (end < 0)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
String charset = text.substring(start, end);
|
||||
// Allow for RFC2231 language
|
||||
int si = charset.indexOf('*');
|
||||
if (si != -1)
|
||||
{
|
||||
charset = charset.substring(0, si);
|
||||
}
|
||||
|
||||
start = end + 1;
|
||||
end = text.indexOf('?', start);
|
||||
if (end < 0)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
String encoding = text.substring(start, end);
|
||||
start = end + 1;
|
||||
end = text.indexOf("?=", start);
|
||||
if (end < 0)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
text = text.substring(start, end);
|
||||
try
|
||||
{
|
||||
// The characters in the remaining string must all be 7-bit clean.
|
||||
// Therefore it is safe just to copy them verbatim into a byte array.
|
||||
char[] chars = text.toCharArray();
|
||||
int len = chars.length;
|
||||
byte[] bytes = new byte[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
bytes[i] = (byte) chars[i];
|
||||
}
|
||||
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
|
||||
InputStream is;
|
||||
if (encoding.equalsIgnoreCase("B"))
|
||||
{
|
||||
is = new Base64InputStream(bis);
|
||||
}
|
||||
else if (encoding.equalsIgnoreCase("Q"))
|
||||
{
|
||||
is = new QInputStream(bis);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedEncodingException("Unknown encoding: " +
|
||||
encoding);
|
||||
}
|
||||
len = bis.available();
|
||||
bytes = new byte[len];
|
||||
len = is.read(bytes, 0, len);
|
||||
String ret = new String(bytes, 0, len, charset);
|
||||
if (text.length() > end + 2)
|
||||
{
|
||||
String extra = text.substring(end + 2);
|
||||
|
||||
ret = ret + extra;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
throw new UnsupportedEncodingException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* QInputStream.java
|
||||
* Copyright(C) 2002 The Free Software Foundation
|
||||
*
|
||||
* This file is part of GNU JavaMail, a library.
|
||||
*
|
||||
* GNU JavaMail is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
*(at your option) any later version.
|
||||
*
|
||||
* GNU JavaMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* As a special exception, if you link this library with other files to
|
||||
* produce an executable, this library does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* This exception does not however invalidate any other reasons why the
|
||||
* executable file might be covered by the GNU General Public License.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.protocol.msn.mail.utils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Provides RFC 2047 "B" transfer encoding.
|
||||
* See section 4.2:
|
||||
* <p>
|
||||
* The "Q" encoding is similar to the "Quoted-Printable" content-
|
||||
* transfer-encoding defined in RFC 2045. It is designed to allow text
|
||||
* containing mostly ASCII characters to be decipherable on an ASCII
|
||||
* terminal without decoding.
|
||||
* <ol>
|
||||
* <li>Any 8-bit value may be represented by a "=" followed by two
|
||||
* hexadecimal digits. For example, if the character set in use
|
||||
* were ISO-8859-1, the "=" character would thus be encoded as
|
||||
* "=3D", and a SPACE by "=20". (Upper case should be used for
|
||||
* hexadecimal digits "A" through "F".)
|
||||
* <li>The 8-bit hexadecimal value 20(e.g., ISO-8859-1 SPACE) may be
|
||||
* represented as "_"(underscore, ASCII 95.). (This character may
|
||||
* not pass through some internetwork mail gateways, but its use
|
||||
* will greatly enhance readability of "Q" encoded data with mail
|
||||
* readers that do not support this encoding.) Note that the "_"
|
||||
* always represents hexadecimal 20, even if the SPACE character
|
||||
* occupies a different code position in the character set in use.
|
||||
* <li>8-bit values which correspond to printable ASCII characters other
|
||||
* than "=", "?", and "_"(underscore), MAY be represented as those
|
||||
* characters. (But see section 5 for restrictions.) In
|
||||
* particular, SPACE and TAB MUST NOT be represented as themselves
|
||||
* within encoded words.
|
||||
*
|
||||
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a>
|
||||
*/
|
||||
public class QInputStream
|
||||
extends QPInputStream
|
||||
{
|
||||
|
||||
private static final int SPACE = 32;
|
||||
private static final int EQ = 61;
|
||||
private static final int UNDERSCORE = 95;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param in the underlying input stream.
|
||||
*/
|
||||
public QInputStream(InputStream in)
|
||||
{
|
||||
super(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a character.
|
||||
*/
|
||||
public int read()
|
||||
throws IOException
|
||||
{
|
||||
int c = in.read();
|
||||
if (c==UNDERSCORE)
|
||||
return SPACE;
|
||||
if (c==EQ)
|
||||
{
|
||||
buf[0] = (byte)in.read();
|
||||
buf[1] = (byte)in.read();
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(new String(buf, 0, 2), 16);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new IOException("Quoted-Printable encoding error: "+
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* QPInputStream.java
|
||||
* Copyright(C) 2002 The Free Software Foundation
|
||||
*
|
||||
* This file is part of GNU JavaMail, a library.
|
||||
*
|
||||
* GNU JavaMail is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
*(at your option) any later version.
|
||||
*
|
||||
* GNU JavaMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* As a special exception, if you link this library with other files to
|
||||
* produce an executable, this library does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* This exception does not however invalidate any other reasons why the
|
||||
* executable file might be covered by the GNU General Public License.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.protocol.msn.mail.utils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* A Quoted-Printable decoder stream.
|
||||
*
|
||||
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a>
|
||||
*/
|
||||
public class QPInputStream
|
||||
extends FilterInputStream
|
||||
{
|
||||
|
||||
protected byte[] buf;
|
||||
|
||||
/**
|
||||
* The number of times read() will return a space.
|
||||
*/
|
||||
protected int spaceCount;
|
||||
|
||||
private static final int LF = 10;
|
||||
private static final int CR = 13;
|
||||
private static final int SPACE = 32;
|
||||
private static final int EQ = 61;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param in the underlying input stream.
|
||||
*/
|
||||
public QPInputStream(InputStream in)
|
||||
{
|
||||
super(new PushbackInputStream(in, 2));
|
||||
buf = new byte[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a character from the stream.
|
||||
*/
|
||||
public int read()
|
||||
throws IOException
|
||||
{
|
||||
if (spaceCount>0)
|
||||
{
|
||||
spaceCount--;
|
||||
return SPACE;
|
||||
}
|
||||
|
||||
int c = in.read();
|
||||
if (c==SPACE)
|
||||
{
|
||||
while ((c = in.read())==SPACE)
|
||||
spaceCount++;
|
||||
if (c==LF || c==CR || c==-1)
|
||||
spaceCount = 0;
|
||||
else
|
||||
{
|
||||
((PushbackInputStream)in).unread(c);
|
||||
c = SPACE;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
if (c==EQ)
|
||||
{
|
||||
int c2 = super.in.read();
|
||||
if (c2==LF)
|
||||
return read();
|
||||
if (c2==CR)
|
||||
{
|
||||
int peek = in.read();
|
||||
if (peek!=LF)
|
||||
((PushbackInputStream)in).unread(peek);
|
||||
return read();
|
||||
}
|
||||
if (c2==-1)
|
||||
return c2;
|
||||
|
||||
buf[0] = (byte)c2;
|
||||
buf[1] = (byte)in.read();
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(new String(buf, 0, 2), 16);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
((PushbackInputStream)in).unread(buf);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
else
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads from the underlying stream into the specified byte array.
|
||||
*/
|
||||
public int read(byte[] bytes, int off, int len)
|
||||
throws IOException
|
||||
{
|
||||
int pos = 0;
|
||||
try
|
||||
{
|
||||
while (pos<len)
|
||||
{
|
||||
int c = read();
|
||||
if (c==-1)
|
||||
{
|
||||
if (pos==0)
|
||||
pos = -1;
|
||||
break;
|
||||
}
|
||||
bytes[off+pos] = (byte)c;
|
||||
pos++;
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
pos = -1;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark is not supported.
|
||||
*/
|
||||
public boolean markSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes that can be read without blocking.
|
||||
*/
|
||||
public int available()
|
||||
throws IOException
|
||||
{
|
||||
return in.available();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
newMail=You have one new Mail from {0} ({1}) with subject: {2}
|
||||
Loading…
Reference in new issue