List of usage examples for org.apache.http.util Args notNull
public static <T> T notNull(T t, String str)
From source file:net.dv8tion.jda.core.entities.Icon.java
/** * Creates an {@link Icon Icon} with the specified {@link java.io.InputStream InputStream}.<br> * We here read the specified InputStream and forward the retrieved byte data to {@link #from(byte[])}. * * @param stream//from w w w. j a v a 2 s . co m * A not-null InputStream. * @return * An Icon instance representing the specified InputStream * @throws IllegalArgumentException * if the provided stream is null * @throws IOException * If the first byte cannot be read for any reason other than the end of the file, * if the input stream has been closed, or if some other I/O error occurs. * @see net.dv8tion.jda.core.utils.IOUtil#readFully(InputStream) */ public static Icon from(InputStream stream) throws IOException { Args.notNull(stream, "InputStream"); return from(IOUtil.readFully(stream)); }
From source file:com.ok2c.lightmtp.impl.protocol.LoggingIOSession.java
public LoggingIOSession(final IOSession session, final String id, final Logger log, final Logger wirelog) { super();//from w ww.j a v a 2s . c om Args.notNull(session, "I/O session"); this.session = session; this.channel = new LoggingByteChannel(); this.id = id; this.log = log; this.wirelog = new Wire(wirelog, this.id); }
From source file:com.ok2c.lightmtp.impl.protocol.SendLocalHeloCodec.java
public SendLocalHeloCodec(final SMTPBuffers iobuffers, final String heloName) { super();//from w ww . j a v a 2 s.c o m Args.notNull(iobuffers, "IO buffers"); this.iobuffers = iobuffers; this.parser = new SMTPReplyParser(); this.writer = new SMTPCommandWriter(); this.codecState = CodecState.SERVICE_READY_EXPECTED; this.heloName = heloName; }
From source file:com.ok2c.lightmtp.impl.protocol.PipeliningSendEnvelopCodec.java
public PipeliningSendEnvelopCodec(final SMTPBuffers iobuffers, final boolean enhancedCodes) { super();//from w w w.j a v a 2s .co m Args.notNull(iobuffers, "IO buffers"); this.iobuffers = iobuffers; this.parser = new SMTPReplyParser(enhancedCodes); this.writer = new SMTPCommandWriter(); this.recipients = new LinkedList<String>(); this.codecState = CodecState.MAIL_REQUEST_READY; this.deliveryFailed = false; }
From source file:com.ok2c.lightmtp.impl.protocol.ClientSession.java
public ClientSession(final IOSession iosession, final SMTPBuffers iobuffers, final DeliveryRequestHandler handler, final ProtocolCodecs<ClientState> codecs) { super();//from w w w.j a v a 2s . c o m Args.notNull(iosession, "IO session"); Args.notNull(iobuffers, "IO buffers"); Args.notNull(handler, "Delivery request handler"); Args.notNull(codecs, "Protocol codecs"); this.iosession = iosession; this.iobuffers = iobuffers; this.iosession.setBufferStatus(this.iobuffers); this.sessionState = new ClientState(); this.context = new SessionContextImpl(iosession); this.handler = handler; this.codecs = codecs; this.state = ProtocolState.INIT; }
From source file:com.ok2c.lightmtp.impl.protocol.ExtendedSendHeloCodec.java
public ExtendedSendHeloCodec(final SMTPBuffers iobuffers, final String heloName, final boolean useAuth) { super();/*from w w w. j a v a2 s . co m*/ Args.notNull(iobuffers, "IO buffers"); this.iobuffers = iobuffers; this.parser = new SMTPReplyParser(); this.writer = new SMTPCommandWriter(); this.codecState = CodecState.SERVICE_READY_EXPECTED; this.heloName = heloName; this.useAuth = useAuth; }
From source file:com.ok2c.lightmtp.impl.protocol.SimpleSendEnvelopCodec.java
public SimpleSendEnvelopCodec(final SMTPBuffers iobuffers, final boolean enhancedCodes) { super();// w w w . j a v a 2 s. co m Args.notNull(iobuffers, "IO buffers"); this.iobuffers = iobuffers; this.parser = new SMTPReplyParser(enhancedCodes); this.writer = new SMTPCommandWriter(); this.recipients = new LinkedList<String>(); this.codecState = CodecState.MAIL_REQUEST_READY; this.deliveryFailed = false; }
From source file:gov.ic.geoint.bulleit.apache.UriPatternMatcher.java
/** * Registers the given object for URIs matching the given pattern. * * @param pattern the pattern to register the handler for. * @param obj the object./* www . j a v a2s . c o m*/ */ public synchronized void register(final String pattern, final T obj) { Args.notNull(pattern, "URI request pattern"); this.map.put(pattern, obj); }
From source file:org.archive.modules.fetcher.BasicExecutionAwareRequest.java
/** * Creates an instance of this class using the given request line. * * @param requestline request line.//from w w w . ja va 2 s . c om */ public BasicExecutionAwareRequest(final RequestLine requestline) { super(); this.requestline = Args.notNull(requestline, "Request line"); this.method = requestline.getMethod(); this.uri = requestline.getUri(); }
From source file:com.ok2c.lightmtp.impl.protocol.ServiceShutdownCodec.java
@Override public void produceData(final IOSession iosession, final ServerState sessionState) throws IOException, SMTPProtocolException { Args.notNull(iosession, "IO session"); Args.notNull(sessionState, "Session state"); SessionOutputBuffer buf = this.iobuffers.getOutbuf(); if (this.pendingReply != null) { this.writer.write(this.pendingReply, buf); this.pendingReply = null; }/*from www . ja v a 2 s . c om*/ if (buf.hasData()) { buf.flush(iosession.channel()); } if (!buf.hasData()) { this.completed = true; iosession.close(); } }