Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-net.jar Source Code
commons-net.jar is the bytecode of Apache Commons Net library, which implements the client side of many basic Internet protocols.
Apache Commons Net Source Code files are provided in the binary packge (commons-net-3.8.0-bin.zip). You can download it at Apache Commons Net Website.
The source code of commons-net-3.8.0.jar is provided below:
✍: FYIcenter
⏎ org/apache/commons/net/nntp/Article.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.net.nntp; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import org.apache.commons.net.util.NetConstants; /** * This is a class that contains the basic state needed for message retrieval and threading. * With thanks to Jamie Zawinski (jwz@jwz.org) */ public class Article implements Threadable { private long articleNumber; private String subject; private String date; private String articleId; private String simplifiedSubject; private String from; private ArrayList<String> references; private boolean isReply; public Article kid, next; public Article() { articleNumber = -1; // isDummy } /** * Adds a message-id to the list of messages that this message references (i.e. replies to) * @param msgId the message id to add */ public void addReference(final String msgId) { if (msgId == null || msgId.isEmpty()) { return; } if (references == null) { references = new ArrayList<>(); } isReply = true; Collections.addAll(references, msgId.split(" ")); } /** * Returns the MessageId references as an array of Strings * @return an array of message-ids */ public String[] getReferences() { if (references == null) { return NetConstants.EMPTY_STRING_ARRAY; } return references.toArray(NetConstants.EMPTY_STRING_ARRAY); } /** * Attempts to parse the subject line for some typical reply signatures, and strip them out * */ private void simplifySubject() { int start = 0; final String subject = getSubject(); final int len = subject.length(); boolean done = false; while (!done) { done = true; // skip whitespace // "Re: " breaks this while (start < len && subject.charAt(start) == ' ') { start++; } if (start < (len - 2) && (subject.charAt(start) == 'r' || subject.charAt(start) == 'R') && (subject.charAt(start + 1) == 'e' || subject.charAt(start + 1) == 'E')) { if (subject.charAt(start + 2) == ':') { start += 3; // Skip "Re:" done = false; } else if ( start < (len - 2) && (subject.charAt(start + 2) == '[' || subject.charAt(start + 2) == '(')) { int i = start + 3; while (i < len && subject.charAt(i) >= '0' && subject.charAt(i) <= '9') { i++; } if (i < (len - 1) && (subject.charAt(i) == ']' || subject.charAt(i) == ')') && subject.charAt(i + 1) == ':') { start = i + 2; done = false; } } } if ("(no subject)".equals(simplifiedSubject)) { simplifiedSubject = ""; } int end = len; while (end > start && subject.charAt(end - 1) < ' ') { end--; } if (start == 0 && end == len) { simplifiedSubject = subject; } else { simplifiedSubject = subject.substring(start, end); } } } /** * Recursive method that traverses a pre-threaded graph (or tree) * of connected Article objects and prints them out. * @param article the root of the article 'tree' * @since 3.4 */ public static void printThread(final Article article) { printThread(article, 0, System.out); } /** * Recursive method that traverses a pre-threaded graph (or tree) * of connected Article objects and prints them out. * @param article the root of the article 'tree' * @param ps the PrintStream to use * @since 3.4 */ public static void printThread(final Article article, final PrintStream ps) { printThread(article, 0, ps); } /** * Recursive method that traverses a pre-threaded graph (or tree) * of connected Article objects and prints them out. * @param article the root of the article 'tree' * @param depth the current tree depth */ public static void printThread(final Article article, final int depth) { printThread(article, depth, System.out); } /** * Recursive method that traverses a pre-threaded graph (or tree) * of connected Article objects and prints them out. * @param article the root of the article 'tree' * @param depth the current tree depth * @param ps the PrintStream to use * @since 3.4 */ public static void printThread(final Article article, final int depth, final PrintStream ps) { for (int i = 0; i < depth; ++i) { ps.print("==>"); } ps.println(article.getSubject() + "\t" + article.getFrom()+"\t"+article.getArticleId()); if (article.kid != null) { printThread(article.kid, depth + 1); } if (article.next != null) { printThread(article.next, depth); } } public String getArticleId() { return articleId; } public long getArticleNumberLong() { return articleNumber; } public String getDate() { return date; } public String getFrom() { return from; } public String getSubject() { return subject; } public void setArticleId(final String string) { articleId = string; } public void setArticleNumber(final long l) { articleNumber = l; } public void setDate(final String string) { date = string; } public void setFrom(final String string) { from = string; } public void setSubject(final String string) { subject = string; } @Override public boolean isDummy() { return (articleNumber == -1); } @Override public String messageThreadId() { return articleId; } @Override public String[] messageThreadReferences() { return getReferences(); } @Override public String simplifiedSubject() { if(simplifiedSubject == null) { simplifySubject(); } return simplifiedSubject; } @Override public boolean subjectIsReply() { return isReply; } @Override public void setChild(final Threadable child) { this.kid = (Article) child; flushSubjectCache(); } private void flushSubjectCache() { simplifiedSubject = null; } @Override public void setNext(final Threadable next) { this.next = (Article)next; flushSubjectCache(); } @Override public Threadable makeDummy() { return new Article(); } @Override public String toString(){ // Useful for Eclipse debugging return articleNumber + " " +articleId + " " + subject; } // DEPRECATED METHODS - for API compatibility only - DO NOT USE @Deprecated public int getArticleNumber() { return (int) articleNumber; } @Deprecated public void setArticleNumber(final int a) { articleNumber = a; } @Deprecated public void addHeaderField(final String name, final String val) { } }
⏎ org/apache/commons/net/nntp/Article.java
Or download all of them as a single archive file:
File name: commons-net-3.8.0-sources.jar File size: 437325 bytes Release date: 2020-01-22 Download
⇒ Download and Install commons-net.jar Binary Package
2009-02-08, 133201👍, 0💬
Popular Posts:
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
How to download and install xml-commons External Source Package? The source package contains Java so...
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...