/*** * Same as <code> copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); </code> * @param source where to copy from * @param dest where to copy to * @return number of bytes copied * @throws CopyStreamException on error ***/ public static final long copyReader(Reader source, Writer dest) throws CopyStreamException { return copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); }
/*** * Copies the contents of a Reader to a Writer using a * copy buffer of a given size. The contents of the Reader are * read until its end is reached, but neither the source nor the * destination are closed. You must do this yourself outside of the * method call. The number of characters read/written is returned. * * @param source The source Reader. * @param dest The destination writer. * @param bufferSize The number of characters to buffer during the copy. * A zero or negative value means to use {@link #DEFAULT_COPY_BUFFER_SIZE}. * @return The number of characters read/written in the copy operation. * @throws CopyStreamException If an error occurs while reading from the * source or writing to the destination. The CopyStreamException * will contain the number of bytes confirmed to have been * transferred before an * IOException occurred, and it will also contain the IOException * that caused the error. These values can be retrieved with * the CopyStreamException getTotalBytesTransferred() and * getIOException() methods. ***/ public static final long copyReader(Reader source, Writer dest, int bufferSize) throws CopyStreamException { return copyReader(source, dest, bufferSize, CopyStreamEvent.UNKNOWN_STREAM_SIZE, null); }
/*** * List the command help from the server. * <p> * @return The sever help information. * @throws NNTPConnectionClosedException * If the NNTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send NNTP reply code 400. This exception may be caught either * as an IOException or independently as itself. * @throws IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ public String listHelp() throws IOException { if (!NNTPReply.isInformational(help())) { return null; } StringWriter help = new StringWriter(); BufferedReader reader = new DotTerminatedMessageReader(_reader_); Util.copyReader(reader, help); reader.close(); help.close(); return help.toString(); }
/*** * Same as <code> copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); </code> ***/ public static final long copyReader(Reader source, Writer dest) throws CopyStreamException { return copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); }
/*** * Same as <code> copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); </code> ***/ public static final long copyReader(Reader source, Writer dest) throws CopyStreamException { return copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE); }
/*** * Copies the contents of a Reader to a Writer using a * copy buffer of a given size. The contents of the Reader are * read until its end is reached, but neither the source nor the * destination are closed. You must do this yourself outside of the * method call. The number of characters read/written is returned. * <p> * @param source The source Reader. * @param dest The destination writer. * @param bufferSize The number of characters to buffer during the copy. * @return The number of characters read/written in the copy operation. * @exception CopyStreamException If an error occurs while reading from the * source or writing to the destination. The CopyStreamException * will contain the number of bytes confirmed to have been * transferred before an * IOException occurred, and it will also contain the IOException * that caused the error. These values can be retrieved with * the CopyStreamException getTotalBytesTransferred() and * getIOException() methods. ***/ public static final long copyReader(Reader source, Writer dest, int bufferSize) throws CopyStreamException { return copyReader(source, dest, bufferSize, CopyStreamEvent.UNKNOWN_STREAM_SIZE, null); }
/*** * Copies the contents of a Reader to a Writer using a * copy buffer of a given size. The contents of the Reader are * read until its end is reached, but neither the source nor the * destination are closed. You must do this yourself outside of the * method call. The number of characters read/written is returned. * <p> * @param source The source Reader. * @param dest The destination writer. * @param bufferSize The number of characters to buffer during the copy. * @return The number of characters read/written in the copy operation. * @exception CopyStreamException If an error occurs while reading from the * source or writing to the destination. The CopyStreamException * will contain the number of bytes confirmed to have been * transferred before an * IOException occurred, and it will also contain the IOException * that caused the error. These values can be retrieved with * the CopyStreamException getTotalBytesTransferred() and * getIOException() methods. ***/ public static final long copyReader(Reader source, Writer dest, int bufferSize) throws CopyStreamException { return copyReader(source, dest, bufferSize, CopyStreamEvent.UNKNOWN_STREAM_SIZE, null); }
/*** * List the command help from the server. * <p> * @return The sever help information. * @exception NNTPConnectionClosedException * If the NNTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send NNTP reply code 400. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ public String listHelp() throws IOException { StringWriter help; Reader reader; if (!NNTPReply.isInformational(help())) return null; help = new StringWriter(); reader = new DotTerminatedMessageReader(_reader_); Util.copyReader(reader, help); reader.close(); help.close(); return help.toString(); }
/*** * List the command help from the server. * <p> * @return The sever help information. * @exception NNTPConnectionClosedException * If the NNTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send NNTP reply code 400. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ public String listHelp() throws IOException { StringWriter help; Reader reader; if (!NNTPReply.isInformational(help())) return null; help = new StringWriter(); reader = new DotTerminatedMessageReader(_reader_); Util.copyReader(reader, help); reader.close(); help.close(); return help.toString(); }