Annotary
Sort

14.3.1.  Regular Expression Syntax

www.ics.com
harsha vardhan harsha vardhan
3 months ago
\.\*
Cancel
\\\.
Cancel
at the beginning
Cancel
Matches Help if it occurs at the beginning of the string.
Cancel
Matches one or more white space at the end of the string.
Cancel
Show all 5 highlights
Sort

Matcher (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
An engine that performs match operations on a character sequence by interpreting a Pattern
Cancel
A matcher is created from a pattern by invoking the pattern's matcher method.
Cancel
entire input sequence against the pattern.
Cancel
starting at the beginning
Cancel
scans the input sequence
Cancel
The way that the region boundaries interact with some pattern constructs can be changed. See useAnchoringBounds and useTransparentBounds for more details.
Cancel
region
Cancel
Show all 7 highlights
Sort

UTS #18: Unicode Regular Expressions

www.unicode.org
harsha vardhan harsha vardhan
3 months ago
The character set used by the regular expression writer may not be Unicode, or may not have the ability to input all Unicode code points from a keyboard.
Cancel
Sort

UTS #35: Unicode Locale Data Markup Language

www.unicode.org
harsha vardhan harsha vardhan
3 months ago
The best practice for internationalization is to store and communicate language-neutral data, and format that data for the client.
Cancel
a server might format data based on the user's locale, or it could be that a client machine does the formatting
Cancel
Show all 2 highlights
Sort

Character.UnicodeScript (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Returns the UnicodeScript constant with the given Unicode script name or the script name alias. Script names and their aliases are determined by The Unicode Standard. The files Scripts<version>.txt and PropertyValueAliases<version>.txt define script names and the script name aliases for a particular version of the standard. The Character class specifies the version of the standard that it supports.

Character case is ignored for all of the valid script names. The en_US locale's case mapping rules are used to provide case-insensitive string comparisons for script name validation.

Cancel
Sort

Pattern (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
A compiled representation of a regular expression.
Cancel
though for repeated matches it is less efficient since it does not allow the compiled pattern to be reused.
Cancel
All of the state involved in performing a match resides in the matcher, so many matchers can share the same pattern.
Cancel
Matcher m = p.matcher("aaaaab");
Cancel
for su
Cancel

This method compiles an expression and matches an input sequence against it in a single invocation. The statement

 boolean b = Pattern.matches("a*b", "aaaaab");
Cancel
Instances of this class are immutable and are safe for use by multiple concurrent threads. Instances of the Matcher class are not safe for such use.
Cancel
<= m <= 3, 0 <= n <= 7
Cancel
\uhhhh The character with hexadecimal value 0xhhhh
Cancel
Character.MIN_CODE_POINT
Cancel
Character.MAX_CODE_POINT
Cancel
escape character
Cancel
^
Cancel
may or may not match line terminators
Cancel
Predefined character classes
US-ASCII
Cancel
\w A word character: [a-zA-Z_0-9]
alphanumeric
Cancel
\h A horizontal whitespace character
Cancel
\xA0
no break space
Cancel
\u1680
ogham (rish) space mark -
Cancel
\u180e
mangolian vowel seperator
Cancel
(US-ASCII only)
Cancel
\t\n\x0B\f\r
ob line tabulation vertical tab
Cancel
x85
next line
Cancel
u2028
line seperator
Cancel
u2029
paragrah seperator
Cancel
\v A vertical whitespace character:
Cancel
One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
does not include space
Cancel
A visible character: [\p{Alnum}\p{Punct}]
grapheme clustures
Cancel
\x00-\x7F
Cancel
space or a tab:
Cancel
\x20
space
Cancel
a-f
Cancel
javaMirrored
() <> {} []
Cancel
Cancel
DOTALL flag
Cancel
MULTILINE
Cancel
prefix Is
Cancel
script keyword (or its short form sc)
Cancel
prefix In
Cancel
block (or its short form blk)
Cancel
Perl 5
Cancel
flags()
Returns this pattern's match flags.
Cancel
String quote(String s)
Returns a literal pattern String for the specified String.
Cancel
US-ASCII
Cancel
(?i)
Cancel
'\n' line terminator is recognized in the behavior of ., ^, and $.
Cancel
(?d).
Cancel
Permits whitespace and comments in pattern
Cancel
(?x)
Cancel
In multiline mode the expressions ^ and $ match just after or just before, respectively, a line terminator or the end of the input sequence. By default these expressions only match at the beginning and the end of the entire input sequence.
Cancel
(?m)
Cancel
When this flag is specified then the input string that specifies the pattern is treated as a sequence of literal characters. Metacharacters or escape sequences in the input sequence will be given no special meaning.
??
Cancel
whitespace is ignored, and embedded comments starting with # are ignored until the end of a line.
Cancel
The flags CASE_INSENSITIVE and UNICODE_CASE retain their impact on matching when used in conjunction with this flag. The other flags become superfluous
??
Cancel
including a line terminator
Cancel
?s
Cancel
Unicode-aware case folding.
Cancel
?u
Cancel
canonical equivalence.
Cancel
By default, matching does not take canonical equivalence into account
Cancel
two characters will be considered to match if, and only if, their full canonical decompositions match.
Cancel
Unicode version of Predefined character classes and POSIX character classes.
Cancel
?U)
Cancel
The flag implies UNICODE_CASE
Cancel
\u030A
ring above
Cancel
may impose a performance penalty.
Cancel
regular expression from which this pattern was compiled.
Cancel

This is the regular expression from which this pattern was compiled.

Cancel
Pattern.compile(regex).matcher(input).matches()
Cancel
that is terminated by another subsequence that matches this pattern or is terminated by the end of the input sequence
Cancel
If this pattern does not match any subsequence of the input then the resulting array has just one element, namely the input sequence in string form.
Cancel
When there is a positive-width match at the beginning of the input sequence then an empty leading substring is included at the beginning of the resulting array
Cancel
limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array
Cancel
If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.
Cancel
If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter.
Cancel
n is non-positive then the pattern will be applied as many times as possible
Cancel
""
Cancel
""
pattern reads n+1 times
Cancel
}
the trailing empty strings are discarded
Cancel
limit argument of zero
Cancel
Trailing empty strings are therefore not included in the resulting array.
Cancel
Metacharacters or escape sequences in the input sequence will be given no special meaning.
Cancel
literal pattern String
Cancel
Trailing empty strings will be discarded and not encountered in the stream.
Cancel
If the input sequence is mutable, it must remain constant during the execution of the terminal stream operation. Otherwise, the result of the terminal stream operation is undefined.
Cancel
Show all 87 highlights
Sort

FileSystem (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
channels, directory-streams, watch-service, and other closeable objects associated
Cancel
The default file system cannot be closed.
Cancel
File systems created by the default provider are always open.
Cancel
An implementation may support multiple name separators in which case this method returns an implementation specific default name separator
Cancel
The order of the elements is not defined.
Cancel
file hierarchies may change during the lifetime of the Java virtual machine. For example, in some implementations, the insertion of removable media may result in the creation of a new file hierarchy with its own top-level directory.
Cancel
When a security manager is installed, it is invoked to check access to the each root directory. If denied, the root directory is not returned by the iterator. In the case of the default provider, the SecurityManager.checkRead(String) method is invoked to check read access to each root directory. It is system dependent if the permission checks are done when the iterator is obtained or during iteration.
Cancel
The order of the elements is not defined and the file stores may change during the lifetime of the Java virtual machine.
Cancel
If denied, then no file stores are returned by the iterator
Cancel
In addition, the security manager's SecurityManager.checkRead(String) method is invoked to check read access to the file store's top-most directory. If denied, the file store is not returned by the iterator
Cancel
It is system dependent if the permission checks are done when the iterator is obtained or during iteration
Cancel
RuntimePermission("getFileStoreAttributes")
Cancel
The BasicFileAttributeView is required to be supported and therefore the set contains at least one element, "basic".
Cancel
For example, on UNIX systems, the NUL (\u0000) character is not allowed to be present in a path.
Cancel
complex path syntax
Cancel
InvalidPathException
Cancel
definition of paths at the platform or virtual file system level.
Cancel
For example, an operating system may not allow specific characters to be present in a file name, but a specific underlying file store may impose different or additional restrictions on the set of legal characters.
Cancel
index value indicating the first position
Cancel
syntax:pattern
Cancel
"glob" and "regex" syntaxes, and may support others
Cancel
without crossing directory boundaries.
Cancel
** characters matches zero or more characters crossing directory boundaries.
Cancel
The backslash character (\) is used to escape characters that would otherwise be interpreted as special characters
Cancel
[ ] characters are a bracket expression that match a single character
Cancel
hyphen (-) may be used to specify a range
Cancel
{ } characters are a group of subpatterns
Cancel
Groups cannot be nested.
Cancel
The Files.isHidden(java.nio.file.Path) method may be used to test whether a file is considered hidden.
Cancel
For both the glob and regex syntaxes, the matching details, such as whether the matching is case sensitive, are implementation-dependent and therefore not specified
Cancel
UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService(); Files.setOwner(path, lookupService.lookupPrincipalByName("joe"));
Cancel
UnsupportedOperationException - If this FileSystem does not does have a lookup service
Cancel
Show all 32 highlights
Sort

MappedByteBuffer (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
A direct byte buffer whose content is a memory-mapped region of a file.
Cancel
A mapped byte buffer and the file mapping that it represents remain valid until the buffer itself is garbage-collected.
Cancel
All or part of a mapped byte buffer may become inaccessible at any time, for example if the mapped file is truncated. An attempt to access an inaccessible region of a mapped byte buffer will not change the buffer's content and will cause an unspecified exception to be thrown either at the time of the access or at some later time.
Cancel
Mapped byte buffers otherwise behave no differently than ordinary direct byte buffers.
direct buffers mean that the buffer is stored in heap like other objects arrays etc...
Cancel
A return value of true implies that it is highly likely that all of the data in this buffer is resident in physical memory and may therefore be accessed without incurring any virtual-memory page faults or I/O operations
Cancel
A return value of false does not necessarily imply that the buffer's content is not resident in physical memory.
Cancel
The returned value is a hint, rather than a guarantee,
Cancel
Invoking this method may cause some number of page faults and I/O operations to occur.
Cancel
If the file does not reside on a local device then no such guarantee is made.
Cancel
If this buffer was not mapped in read/write mode (FileChannel.MapMode.READ_WRITE) then invoking this method has no effect.
Cancel
Show all 10 highlights
Sort

RandomAccessFile (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Cancel
set by the seek method.
Cancel
A random access file behaves like a large array of bytes stored in the file system.
Cancel
There is a kind of cursor, or index into the implied array, called the file pointer
Cancel
Output operations that write past the current end of the implied array cause the array to be extended
Cancel
In particular, an IOException may be thrown if the stream has been closed.
Cancel
"rws" Open for reading and writing, as with "rw", and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.
Cancel
Although RandomAccessFile is not a subclass of InputStream, this method behaves in exactly the same way as the InputStream.read() method of InputStream.
Cancel
This method never throws an EOFException
Cancel
If n is negative, no bytes are skipped.
Cancel
Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.
Cancel
If the present length of the file as returned by the length method is greater than the newLength argument then the file will be truncated. In this case, if the file offset as returned by the getFilePointer method is greater than newLength then after this method returns the offset will be equal to newLength.
Cancel
If the present length of the file as returned by the length method is smaller than the newLength argument then the file will be extended. In this case, the contents of the extended portion of the file are not defined.
Cancel
Each byte is converted into a character by taking the byte's value for the lower eight bits of the character and setting the high eight bits of the character to zero. This method does not, therefore, support the full Unicode character set.
Cancel
The first two bytes are read, starting from the current file pointer, as if by readUnsignedShort. This value gives the number of following bytes that are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding characters in the modified UTF-8 format and are converted into characters.
Cancel
This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.
Cancel
high byte first
Cancel
Each character in the string is written out, in sequence, by discarding its high eight bits
Cancel
Show all 18 highlights
Sort

FileChannel (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
mapping, and manipulating a file.
Cancel
The file may also have some associated metadata such as access permissions, content type, and last-modification time; this class does not define methods for metadata access.
Cancel
Bytes may be read or written at an absolute position in a file in a way that does not affect the channel's current position.
Cancel
A region of a file may be mapped directly into memory
Cancel
Updates made to a file may be forced out to the underlying storage device
Cancel
Bytes can be transferred from a file to some other channel, and vice versa, in a way that can be optimized by many operating systems into a very fast transfer directly to or from the filesystem cache
Cancel
A region of a file may be locked against access by other programs.
Cancel
File channels are safe for use by multiple concurrent threads
Cancel
Only one operation that involves the channel's position or can change its file's size may be in progress at any given time; attempts to initiate a second such operation while the first is still in progress will block until the first operation completes.
such as read write
Cancel
in the same program
Cancel
due to caching performed by the underlying operating system and delays induced by network-filesystem protocols
Cancel
A file channel that is open for writing may be in append mode, for example if it was obtained from a file-output stream that was created by invoking the FileOutputStream(File,boolean) constructor and passing true for the second parameter
Cancel
If neither option (or the APPEND option) is contained in the array then the file is opened for reading
Cancel
The new channel is created by invoking the newFileChannel method on the provider that created the Path.
Cancel
unless the channel is in append mode,
Cancel
Setting the position to a value that is greater than the file's current size is legal but does not change the size of the file. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the file to be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
Cancel
If the file does not reside on a local device then no such guarantee is made.
Cancel
The metaData parameter can be used to limit the number of I/O operations that this method is required to perform
Cancel
which generally requires at least one more I/O operation
Cancel
Invoking this method may cause an I/O operation to occur even if the channel was only opened for reading. Some operating systems, for example, maintain a last-access time as part of a file's metadata, and this time is updated whenever the file is read
Cancel
It may or may not force changes that were made by modifying the content of a mapped byte buffer obtained by invoking the map method.
Cancel
An attempt is made to read up to count bytes starting at the given position in this channel's file and write them to the target channel
Cancel
depends upon the natures and states of the channels
Cancel
This method does not modify this channel's position
Cancel
Many operating systems can transfer bytes directly from the filesystem cache to the target channel without actually copying them.
Cancel
An attempt is made to read up to count bytes from the source channel and write them to this channel's file starting at the given position.
Cancel
This method does not modify this channel's position.
Cancel
If the given position is greater than the file's current size then no bytes are transferred
why is the file size not increased
Cancel
Many operating systems can transfer bytes directly from the source channel into the filesystem cache without actually copying them.
Cancel
starting at the given file position.
Cancel
This method does not modify this channel's position
Cancel
If the given position is greater than the file's current size then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
Cancel
Read/write: Changes made to the resulting buffer will eventually be propagated to the file; they may or may not be made visible to other programs that have mapped the same file. (MapMode.READ_WRITE)
Cancel
they will cause private copies of the modified portions of the buffer to be created
Cancel
A mapping, once established, is not dependent upon the file channel that was used to create it. Closing the channel, in particular, has no effect upon the validity of the mapping.
becomes invalid when gc
Cancel
The behavior of this method when the requested region is not completely contained within this channel's file is unspecified
Cancel
Whether changes made to the content or size of the underlying file, by this program or another, are propagated to the buffer is unspecified
Cancel
The rate at which changes to the buffer are propagated to the file is unspecified.
Cancel
For most operating systems, mapping a file into memory is more expensive than reading or writing a few tens of kilobytes of data via the usual read and write methods. From the standpoint of performance it is generally only worth mapping relatively large files into memory.
Cancel
An invocation of this method will block
Cancel
If the invoking thread is interrupted while waiting to acquire the lock then its interrupt status will be set and a FileLockInterruptionException will be thrown.
Cancel
If the invoker's interrupt status is set when this method is invoked then that exception will be thrown immediately; the thread's interrupt status will not be changed.
Cancel
Lock regions are fixed in size
Cancel
The zero-argument lock() method simply locks a region of size Long.MAX_VALUE.
Cancel
This method does not block. An invocation always returns immediately, either having acquired a lock on the requested region or having failed to do so. If it fails to acquire a lock because an overlapping lock is held by another program then it returns
Cancel
This method does not block.
Cancel
If it fails to acquire a lock for any other reason then an appropriate exception is thrown.
Cancel
fails to acquire a lock because an overlapping lock is held by another program then it returns null
Cancel
Show all 49 highlights
Sort

AbstractInterruptibleChannel (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
operation will immediately return, either by throwing an exception or by returning normally.
Cancel
If a thread is interrupted or the channel upon which it is blocked is asynchronously closed then the channel's end method will throw the appropriate exception.
Cancel
This class performs the synchronization required to implement the Channel specification.
Cancel
Implementations of the implCloseChannel method need not synchronize against other threads that might be attempting to close the channel.
Cancel
Otherwise it marks the channel as closed and then invokes the implCloseChannel method in order to complete the close operation.
Cancel
This method is only invoked if the channel has not yet been closed, and it is never invoked more than once.
Cancel
Show all 6 highlights
Sort

InterruptibleChannel (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
If a thread is blocked in an I/O operation on an interruptible channel then another thread may invoke the channel's close method. This will cause the blocked thread to receive an AsynchronousCloseException.
Cancel
If a thread's interrupt status is already set and it invokes a blocking I/O operation upon a channel then the channel will be closed and the thread will immediately receive a ClosedByInterruptException; its interrupt status will remain set.
Cancel
If a thread is blocked in an I/O operation on an interruptible channel then another thread may invoke the blocked thread's interrupt method. This will cause the channel to be closed, the blocked thread to receive a ClosedByInterruptException, and the blocked thread's interrupt status to be set.
Cancel
A channel supports asynchronous closing and interruption if, and only if, it implements this interface. This can be tested at runtime, if necessary, via the instanceof operator.
Cancel
Show all 4 highlights
Sort

ScatteringByteChannel (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
A channel that can read bytes into a sequence of buffers
Cancel
A scattering read operation reads, in a single invocation, a sequence of bytes into one or more of a given sequence of buffers.
Cancel
Show all 2 highlights
Sort

OutputStreamWriter (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
An OutputStreamWriter is a bridge from character streams to byte streams
Cancel
Each invocation of a write() method causes the encoding converter to be invoked on the given character(s).
Cancel
The resulting bytes are accumulated in a buffer before being written to the underlying output stream.
Cancel
A malformed surrogate element is a high surrogate that is not followed by a low surrogate or a low surrogate that is not preceded by a high surrogate.
Cancel
This class always replaces malformed surrogate elements and unmappable character sequences with the charset's default substitution sequence. The CharsetEncoder class should be used when more control over the encoding process is required.
Cancel
If the encoding has an historical name then that name is returned; otherwise the encoding's canonical name is returned.
Cancel

This method may return null if the stream has been closed.

Returns:
Cancel
This method may return null if the stream has been closed
Cancel
further write() or flush() invocations will cause an IOException to be thrown.
Cancel
Show all 9 highlights
Sort

PrintWriter (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Prints formatted representations of objects to a text-output stream
Cancel
Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the println, printf, or format methods is invoked, rather than whenever a newline character happens to be output. These methods use the platform's own notion of line separator rather than the newline character
Cancel
never throw I/O exceptions, although some of its constructors may
similar to printstream
Cancel
This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.
Cancel
This convenience constructor creates the necessary intermediate OutputStreamWriter, which will encode characters using the default charset for this instance of the Java virtual machine.
Cancel
This convenience constructor creates the necessary intermediate OutputStreamWriter, which will encode characters using the provided charset.
Cancel
This method cannot be inherited from the Writer class because it must suppress I/O exceptions.
Cancel
The string produced by String.valueOf(boolean) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Cancel
If the argument is null then the string "null" is printed
Cancel

An invocation of this method of the form out.printf(format, args) behaves in exactly the same way as the invocation

     out.format(format, args) 
Cancel

An invocation of this method of the form out.printf(l, format, args) behaves in exactly the same way as the invocation

     out.format(l, format, args) 
Cancel
Show all 12 highlights
Sort

CharSequence (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Returns a stream of int zero-extending the char values from this sequence.
Cancel
Sort

Formatter (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
This class provides support for layout justification and alignment, common formats for numeric, string, and date/time data, and locale-specific output
Cancel
Common Java types such as byte, BigDecimal, and Calendar are supported
Cancel
Also, Java formatting is more strict than C's; for example, if a conversion is incompatible with a flag, an exception will be thrown. In C inapplicable flags are silently ignored
Cancel
Explicit argument indices may be used to re-order output.
Cancel
'
Cancel
'(' numeric flag may be used to format negative numbers with // parentheses rather than a minus sign
Cancel
Group separators are // automatically inserted.
Cancel
%1$tb %1$te, %1$tY", c); // -> s == "Duke's Birthday: May 23, 1995"
Cancel
%[argument_index$][flags][width][.precision]conversion
Cancel
The set of valid conversions for a given argument depends on the argument's data type.
Cancel
dates and times
Cancel
The required conversion is a two character sequence
Cancel
The second character indicates the format to be used. These characters are similar to but not completely identical to those defined by GNU date and POSIX strftime(3c)
Cancel
The first character is 't' or 'T'
Cancel
Show all 14 highlights
Sort

String (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
String concatenation is implemented through the StringBuilder(or StringBuffer) class and its append method.
Cancel
Unless otherwise noted, passing a null argument to a constructor or method in this class will cause a NullPointerException to be thrown.
Cancel
Index values refer to char code units, so a supplementary character uses two positions in a String.
Cancel
Show all 4 highlights
Sort

PrintStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently
Cancel
Optionally, a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.
Cancel
Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method
Cancel
All characters printed by a PrintStream are converted into bytes using the platform's default character encoding
Cancel
UnsupportedEncodingException - If the named encoding is not supported
Cancel
This convenience constructor creates the necessary intermediate OutputStreamWriter, which will encode characters using the default charset for this instance of the Java virtual machine.
Cancel
If the file exists, then it will be truncated to zero size; otherwise, a new file will be created. The output will be written to the file and is buffered.
Cancel
Flushes the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.
Cancel
This is done by flushing the stream and then closing the underlying output stream.
Cancel
If an operation on the underlying output stream throws an InterruptedIOException, then the PrintStream converts the exception back into an interrupt by doing:
     Thread.currentThread().interrupt();
 
or the equivalent.
interrupted exception is different frm interruptedioexception
the printwriter converts the interruptedioex to ioexception
Cancel
The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException, and when the setError method is invoked.
Cancel
Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.
Cancel

An invocation of this method of the form out.printf(format, args) behaves in exactly the same way as the invocation

     out.format(format, args)
Cancel
Depending on the specification of toString for the character sequence csq, the entire sequence may not be appended. For instance, invoking then toString method of a character buffer will return a subsequence whose content depends upon the buffer's position and limit.
Cancel
Show all 17 highlights
Sort

PipedOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
A piped output stream can be connected to a piped input stream to create a communications pipe. The piped output stream is the sending end of the pipe. Typically, data is written to a PipedOutputStream object by one thread and data is read from the connected PipedInputStream by some other thread. Attempting to use both objects from a single thread is not recommended as it may deadlock the thread. The pipe is said to be broken if a thread that was reading data bytes from the connected piped input stream is no longer alive.
Cancel
This method blocks until all the bytes are written to the output stream.
Cancel
Show all 2 highlights
Sort

ObjectOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream
Cancel
Persistent storage of objects can be accomplished by using a file for the stream
Cancel
Show all 2 highlights
Sort

DataOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
protected int written
The number of bytes written to the data output stream so far.
Cancel
Cancel
no direct method to read string by chars in inputstream
Cancel
high byte first
Cancel
modified UTF-8 encoding in a machine-independent manner
Cancel
The flush method of DataOutputStream calls the flush method of its underlying output stream.
since it does not have any buffering
Cancel
floatToIntBits
Cancel
doubleToLongBits
Cancel
Each character in the string is written out, in sequence, by discarding its high eight bits
Cancel
writeChars(String s)
there is no corresponding direct method read method to this in input stream
Cancel
First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow.
Cancel
Show all 11 highlights
Sort

BufferedOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Ordinarily this method stores bytes from the given array into this stream's buffer, flushing the buffer to the underlying output stream as needed. If the requested length is at least as large as this stream's buffer, however, then this method will flush the buffer and write the bytes directly to the underlying output stream. Thus redundant BufferedOutputStreams will not copy data unnecessarily.
Cancel
Sort

FilterOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
This class is the superclass of all classes that filter output streams
Cancel
These streams sit on top of an already existing output stream (the underlying output stream) which it uses as its basic sink of data, but possibly transforming the data along the way or providing additional functionality.
Cancel
The write method of FilterOutputStream calls the write method of its underlying output stream
Cancel
Note that this method does not call the one-argument write method of its underlying stream with the single argument b.
Cancel
Note that this method does not call the write method of its underlying input stream with the same arguments. Subclasses of FilterOutputStream should provide a more efficient implementation of this method.
at the end write gets passes to the underlying stream
Cancel
The close method of FilterOutputStream calls its flush method, and then calls the close method of its underlying output stream.
Cancel
Show all 6 highlights
Sort

FileOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Some platforms, in particular, allow a file to be opened for writing by only one FileOutputStream (or other file-writing object) at a time. In such situations the constructors in this class will fail if the file involved is already open.
Cancel
If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown.
Cancel
If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
Cancel
If fdObj is null then a NullPointerException is thrown.
Cancel
If this stream has an associated channel then the channel is closed as well.
Cancel
Cleans up the connection to the file,
Cancel
Show all 6 highlights
Sort

CharsetDecoder (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
An engine that can transform a sequence of bytes in a specific charset into a sequence of sixteen-bit Unicode characters.
Cancel
Sort

ByteArrayOutputStream (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
This class implements an output stream in which the data is written into a byte array.
Cancel
The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().
Cancel
Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.
Cancel
Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).
Cancel
Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space
Cancel
Returns:
the value of the count field
Cancel
Converts the buffer's contents into a string decoding bytes using the platform's default character set. The length of the new String is a function of the character set, and hence may not be equal to the size of the buffer.
Cancel
This method always replaces malformed-input and unmappable-character sequences with the default replacement string for the platform's default character set. The CharsetDecoder class should be used when more control over the decoding process is required.
Cancel
Show all 8 highlights
Sort

StackTraceElement (Java Platform SE 8 )

docs.oracle.com
harsha vardhan harsha vardhan
3 months ago
Each element represents a single stack frame. All stack frames except for the one at the top of the stack represent a method invocation
Cancel
fileName - the name of the file containing the execution point represented by the stack trace element, or null if this information is unavailable
Cancel
lineNumber - the line number of the source line containing the execution point represented by this stack trace element, or a negative number if this information is unavailable. A value of -2 indicates that the method containing the execution point is a native method
Cancel
Generally, this corresponds to the SourceFile attribute of the relevant class file (as per The Java Virtual Machine Specification, Section 4.7.7). In some systems, the name may refer to some source code unit other than a file, such as an entry in source repository.
Cancel
LineNumberTable attribute of the relevant class file
Cancel
If the execution point is contained in an instance or class initializer, this method will return the appropriate special method name, <init> or <clinit>, as per Section 3.9 of The Java Virtual Machine Specification.
Cancel
Show all 6 highlights
Sort

What is a suppressed exception?

stackoverflow.com
harsha vardhan harsha vardhan
3 months ago
39 down vote accepted

I believe the commenter is referring to is an exception which is semi-ignored when it's thrown within the implicit finally block of a try-with-resources block, in the context of an existing exception being thrown from the try block:

An exception can be thrown from the block of code associated with the try-with-resources statement. In the example writeToFileZipFileContents, an exception can be thrown from the try block, and up to two exceptions can be thrown from the try-with-resources statement when it tries to close the ZipFile and BufferedWriter objects. If an exception is thrown from the try block and one or more exceptions are thrown from the try-with-resources statement, then those exceptions thrown from the try-with-resources statement are suppressed, and the exception thrown by the block is the one that is thrown by the writeToFileZipFileContents method. You can retrieve these suppressed exceptions by calling the Throwable.getSuppressed method from the exception thrown by the try block.

Cancel

To clarify the quote in Jon's answer, only one exception can be thrown by a method (per execution) but it is possible, in the case of a try-with-resources, for multiple exceptions to be thrown. For instance one might be thrown in the block and another might be thrown from the implicit finally provided by the try-with-resources.

The compiler has to determine which of these to "really" throw. It chooses to throw the exception raised in the explicit code (the code in the try block) rather than the one thrown by the implicit code (the finally block). Therefore the exception(s) thrown in the implicit block are suppressed (ignored). This only occurs in the case of multiple exceptions.

Cancel
Show all 2 highlights
Loading...