Package org.apache.james.nntpserver

Examples of org.apache.james.nntpserver.NNTPException


            int read = 0;
            while ((read = fileStream.read(readBuffer)) > 0) {
                out.write(readBuffer, 0, read);
            }
        } catch(Exception ex) {
            throw new NNTPException(ex);
        } finally {
            if (fileStream != null) {
                try {
                    fileStream.close();
                } catch (IOException ioe) {
View Full Code Here


                .append(byteCount)               .append("\t")
                .append(lineCount).append("\r\n");
            String lineString = line.toString();
            out.write(lineString.getBytes("ASCII"));
        } catch(Exception ex) {
            throw new NNTPException(ex);
        } finally {
            if (fileStream != null) {
                try {
                    fileStream.close();
                } catch (IOException ioe) {
View Full Code Here

            FileInputStream fin = new FileInputStream(articleFile);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            return hdr.getHeader(header,null);
        } catch(Exception ex) {
            throw new NNTPException(ex);
        }
    }
View Full Code Here

            boolean renamed = f.renameTo(new File(spool.getSpoolPath(),f.getName()));
            if (!renamed) {
                throw new IOException("Could not create article on the spool.");
            }
        } catch(IOException ex) {
            throw new NNTPException("create article failed",ex);
        } finally {
            if (fout != null) {
                try {
                    fout.close();
                } catch (IOException ioe) {
View Full Code Here

            FileInputStream fin = new FileInputStream(f);
            InternetHeaders headers = new InternetHeaders(fin);
            String[] idheader = headers.getHeader("Message-Id");
            fin.close();
            return ( idheader.length > 0 ) ? idheader[0] : null;
        } catch(Exception ex) { throw new NNTPException(ex); }
    }
View Full Code Here

            BufferedReader reader = new BufferedReader(new FileReader(f));
            String line = null;
            while ( ( line = reader.readLine() ) != null )
                prt.println(line);
            reader.close();
        } catch(IOException ex) { throw new NNTPException(ex); }
    }
View Full Code Here

                if ( line.trim().length() == 0 )
                    break;
                prt.println(line);
            }
            reader.close();
        } catch(IOException ex) { throw new NNTPException(ex); }
    }
View Full Code Here

                    prt.println(line);
                else
                    startWriting = ( line.trim().length() == 0 );
            }
            reader.close();
        } catch(IOException ex) { throw new NNTPException(ex); }
    }
View Full Code Here

            prt.print((date==null?"":date)+"\t");
            prt.print((msgId==null?"":msgId)+"\t");
            prt.print((references==null?"":references)+"\t");
            prt.print(byteCount+"\t");
            prt.println(lineCount+"");
        } catch(Exception ex) { throw new NNTPException(ex); }
    }
View Full Code Here

        try {
            FileInputStream fin = new FileInputStream(f);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            return hdr.getHeader(header,null);
        } catch(Exception ex) { throw new NNTPException(ex); }
    }
View Full Code Here

TOP

Related Classes of org.apache.james.nntpserver.NNTPException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.