TeeInputStream tee = new TeeInputStream(is, new PipedOutputStream(in));
@Override public int size() { return headers.size(); } };
@Override public void write(byte[] b, int off, int len) { ensureCapacity(len); System.arraycopy(b, off, buf, count, len); count += len; }
m_fragment = null; else if (!isGenericURI()) { throw new MalformedURIException( "Fragment can only be set for a generic URI!"); else if (getPath() == null) { throw new MalformedURIException( "Fragment cannot be set when path is null!"); else if (!isURIString(p_fragment)) { throw new MalformedURIException( "Fragment contains invalid character!");
public ByteInputStream newInputStream() { return new ByteInputStream(buf,count); }
/** * Set the host for this URI. If null is passed in, the userinfo * field is also set to null and the port is set to -1. * * @param p_host the host for this URI * * @exception MalformedURIException if p_host is not a valid IP * address or DNS hostname. */ public void setHost(String p_host) throws MalformedURIException { if (p_host == null || p_host.trim().length() == 0) { m_host = p_host; m_userinfo = null; m_port = -1; } else if (!isWellFormedAddress(p_host)) { throw new MalformedURIException("Host is not a well formed address!"); } m_host = p_host; }
@Override public void removeAllAttachments() { try { initializeAllAttachments(); } catch (Exception e) { throw new RuntimeException(e); } if (attachments != null) { attachments.clear(); needsSave(); } }
static boolean isArrayByteBase64( byte[] arrayOctect ) { int length = arrayOctect.length; if ( length == 0 ) return false; for ( int i=0; i < length; i++ ) { if ( Base64.isBase64( arrayOctect[i] ) == false) return false; } return true; }
@Override public void close() throws IOException { reset(); }
public MimeMatchingIterator(MimeHeaders headers) { this.headers = headers; this.iter = attachments.iterator(); }
/** * Construct a new URI from a base URI and a URI specification string. * The URI specification string may be a relative URI. * * @param p_base the base URI (cannot be null if p_uriSpec is null or * empty) * @param p_uriSpec the URI specification string (cannot be null or * empty if p_base is null) * * @exception MalformedURIException if p_uriSpec violates any syntax * rules */ public JaxmURI(JaxmURI p_base, String p_uriSpec) throws MalformedURIException { initialize(p_base, p_uriSpec); }
/** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ @Override public String toString() { StringBuilder uriSpecString = new StringBuilder(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); } uriSpecString.append(getSchemeSpecificPart()); return uriSpecString.toString(); }
/******************************************************************* * MalformedURIExceptions are thrown in the process of building a URI * or setting fields on a URI when an operation would result in an * invalid URI specification. * ********************************************************************/ public static class MalformedURIException extends IOException { /****************************************************************** * Constructs a <code>MalformedURIException</code> with no specified * detail message. ******************************************************************/ public MalformedURIException() { super(); } /***************************************************************** * Constructs a <code>MalformedURIException</code> with the * specified detail message. * * @param p_msg the detail message. ******************************************************************/ public MalformedURIException(String p_msg) { super(p_msg); } }
/** * Set the port for this URI. -1 is used to indicate that the port is * not specified, otherwise valid port numbers are between 0 and 65535. * If a valid port number is passed in and the host field is null, * an exception is thrown. * * @param p_port the port number for this URI * * @exception MalformedURIException if p_port is not -1 and not a * valid port number */ public void setPort(int p_port) throws MalformedURIException { if (p_port >= 0 && p_port <= 65535) { if (m_host == null) { throw new MalformedURIException( "Port cannot be set when host is null!"); } } else if (p_port != -1) { throw new MalformedURIException("Invalid port number!"); } m_port = p_port; }
@Override public void remove() { if (last == null) { throw new IllegalStateException(); } eachNamespace.remove(); next = null; last = null; } };
/** * Return the DataFlavors for this <code>DataContentHandler</code> * @return The DataFlavors. */ @Override public DataFlavor[] getTransferDataFlavors() { // throws Exception; DataFlavor flavors[] = new DataFlavor[1]; flavors[0] = new ActivationDataFlavor( FastInfosetReflection.getFastInfosetSource_class(), "application/fastinfoset", "Fast Infoset"); return flavors; }
static String getDefaultMIMECharset() { if (defaultMIMECharset == null) { defaultMIMECharset = SAAJUtil.getSystemProperty("mail.mime.charset"); } if (defaultMIMECharset == null) defaultMIMECharset = mimeCharset(getDefaultJavaCharset()); return defaultMIMECharset; }
protected SOAPPartImpl doCloneNode() { handleNewSource(); SOAPPartImpl newSoapPart = duplicateType(); newSoapPart.headers = MimeHeadersUtil.copy(this.headers); newSoapPart.source = this.source; return newSoapPart; }
TeeInputStream tee = new TeeInputStream(is, new PipedOutputStream(in));
/** * Writes a string as ASCII string. * * @param s string to write. */ public void writeAsAscii(String s) { int len = s.length(); ensureCapacity(len); int ptr = count; for( int i=0; i<len; i++ ) buf[ptr++] = (byte)s.charAt(i); count = ptr; }