Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
e89268b6
Commit
e89268b6
authored
Mar 25, 2002
by
Bryce McKinlay
Committed by
Bryce McKinlay
Mar 25, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* java/io/PushbackReader.java: Reformat.
From-SVN: r51291
parent
1bd6476f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
123 deletions
+67
-123
libjava/ChangeLog
+4
-0
libjava/java/io/PushbackReader.java
+63
-123
No files found.
libjava/ChangeLog
View file @
e89268b6
2002
-
03
-
24
Bryce
McKinlay
<
bryce
@
waitaki
.
otago
.
ac
.
nz
>
*
java
/
io
/
PushbackReader
.
java
:
Reformat
.
2002
-
03
-
24
Tom
Tromey
<
tromey
@
redhat
.
com
>
*
java
/
awt
/
TextComponent
.
java
(
TextComponent
):
Editable
by
...
...
libjava/java/io/PushbackReader.java
View file @
e89268b6
...
...
@@ -55,60 +55,38 @@ package java.io;
*/
public
class
PushbackReader
extends
FilterReader
{
/*************************************************************************/
/*
* Class Variables
*/
/**
/**
* This is the default buffer size
*/
private
static
final
int
DEFAULT_BUFFER_SIZE
=
1
;
/*************************************************************************/
/*
* Instance Variables
*/
private
static
final
int
DEFAULT_BUFFER_SIZE
=
1
;
/**
/**
* This is the buffer that is used to store the pushed back data
*/
private
char
[]
buf
;
private
char
[]
buf
;
/**
/**
* This is the position in the buffer from which the next char will be
* read. Bytes are stored in reverse order in the buffer, starting from
* <code>buf[buf.length - 1]</code> to <code>buf[0]</code>. Thus when
* <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when
* it is empty
*/
private
int
pos
;
/*************************************************************************/
/*
* Constructors
*/
private
int
pos
;
/**
/**
* This method initializes a <code>PushbackReader</code> to read from the
* specified subordinate <code>Reader</code> with a default pushback buffer
* size of 1.
*
* @code in The subordinate stream to read from
*/
public
PushbackReader
(
Reader
in
)
{
public
PushbackReader
(
Reader
in
)
{
this
(
in
,
DEFAULT_BUFFER_SIZE
);
}
/*************************************************************************/
}
/**
/**
* This method initializes a <code>PushbackReader</code> to read from the
* specified subordinate <code>Reader</code> with the specified buffer
* size
...
...
@@ -116,9 +94,8 @@ PushbackReader(Reader in)
* @param in The subordinate <code>Reader</code> to read from
* @param bufsize The pushback buffer size to use
*/
public
PushbackReader
(
Reader
in
,
int
bufsize
)
{
public
PushbackReader
(
Reader
in
,
int
bufsize
)
{
super
(
in
);
if
(
bufsize
<
0
)
...
...
@@ -126,32 +103,23 @@ PushbackReader(Reader in, int bufsize)
buf
=
new
char
[
bufsize
];
pos
=
bufsize
;
}
/*************************************************************************/
/*
* Instance Methods
*/
}
/**
/**
* This method closes the stream and frees any associated resources.
*
* @exception IOException If an error occurs.
*/
public
void
close
()
throws
IOException
{
public
void
close
()
throws
IOException
{
synchronized
(
lock
)
{
buf
=
null
;
super
.
close
();
}
}
/*************************************************************************/
}
/**
/**
* This method throws an exception when called since this class does
* not support mark/reset.
*
...
...
@@ -159,44 +127,35 @@ close() throws IOException
*
* @exception IOException Always thrown to indicate mark/reset not supported.
*/
public
void
mark
(
int
read_limit
)
throws
IOException
{
public
void
mark
(
int
read_limit
)
throws
IOException
{
throw
new
IOException
(
"mark not supported in this class"
);
}
/*************************************************************************/
}
/**
/**
* This method returns <code>false</code> to indicate that it does not support
* mark/reset functionality.
*
* @return This method returns <code>false</code> to indicate that this class does not support mark/reset functionality
*
*/
public
boolean
markSupported
()
{
public
boolean
markSupported
()
{
return
(
false
);
}
/*************************************************************************/
}
/**
/**
* This method always throws an IOException in this class because
* mark/reset functionality is not supported.
*
* @exception IOException Always thrown for this class
*/
public
void
reset
()
throws
IOException
{
public
void
reset
()
throws
IOException
{
throw
new
IOException
(
"reset not supported in this class"
);
}
/*************************************************************************/
}
/**
/**
* This method determines whether or not this stream is ready to be read.
* If it returns <code>false</code> to indicate that the stream is not
* ready, any attempt to read from the stream could (but is not
...
...
@@ -210,9 +169,8 @@ reset() throws IOException
*
* @exception IOException If an error occurs
*/
public
boolean
ready
()
throws
IOException
{
public
boolean
ready
()
throws
IOException
{
synchronized
(
lock
)
{
if
(
buf
==
null
)
...
...
@@ -223,13 +181,11 @@ ready() throws IOException
else
return
(
false
);
}
}
/*************************************************************************/
}
// Don't delete this method just because the spec says it shouldn't be there!
// See the CVS log for details.
/**
// Don't delete this method just because the spec says it shouldn't be there!
// See the CVS log for details.
/**
* This method skips the specified number of chars in the stream. It
* returns the actual number of chars skipped, which may be less than the
* requested amount.
...
...
@@ -244,9 +200,8 @@ ready() throws IOException
*
* @exception IOException If an error occurs
*/
public
long
skip
(
long
num_chars
)
throws
IOException
{
public
long
skip
(
long
num_chars
)
throws
IOException
{
synchronized
(
lock
)
{
if
(
num_chars
<=
0
)
...
...
@@ -264,12 +219,10 @@ skip(long num_chars) throws IOException
long
chars_skipped
=
in
.
skip
(
num_chars
-
chars_discarded
);
return
(
chars_discarded
+
chars_skipped
);
}
// synchronized
}
/*************************************************************************/
}
}
/**
/**
* This method reads an unsigned char from the input stream and returns it
* as an int in the range of 0-65535. This method also will return -1 if
* the end of the stream has been reached. The char returned will be read
...
...
@@ -282,9 +235,8 @@ skip(long num_chars) throws IOException
*
* @exception IOException If an error occurs
*/
public
int
read
()
throws
IOException
{
public
int
read
()
throws
IOException
{
synchronized
(
lock
)
{
if
(
buf
==
null
)
...
...
@@ -296,11 +248,9 @@ read() throws IOException
++
pos
;
return
((
buf
[
pos
-
1
]
&
0xFFFF
));
}
}
/*************************************************************************/
}
/**
/**
* This method read chars from a stream and stores them into a caller
* supplied buffer. It starts storing the data at index <code>offset</code> into
* the buffer and attempts to read <code>len</code> chars. This method can
...
...
@@ -323,9 +273,8 @@ read() throws IOException
*
* @exception IOException If an error occurs.
*/
public
synchronized
int
read
(
char
[]
b
,
int
offset
,
int
len
)
throws
IOException
{
public
synchronized
int
read
(
char
[]
b
,
int
offset
,
int
len
)
throws
IOException
{
synchronized
(
lock
)
{
if
(
buf
==
null
)
...
...
@@ -344,11 +293,9 @@ read(char[] b, int offset, int len) throws IOException
return
super
.
read
(
b
,
offset
,
len
);
}
}
/*************************************************************************/
}
/**
/**
* This method pushes a single char of data into the pushback buffer.
* The char pushed back is the one that will be returned as the first char
* of the next read.
...
...
@@ -362,9 +309,8 @@ read(char[] b, int offset, int len) throws IOException
*
* @exception IOException If the pushback buffer is full.
*/
public
void
unread
(
int
b
)
throws
IOException
{
public
void
unread
(
int
b
)
throws
IOException
{
synchronized
(
lock
)
{
if
(
buf
==
null
)
...
...
@@ -374,12 +320,10 @@ unread(int b) throws IOException
--
pos
;
buf
[
pos
]
=
(
char
)(
b
&
0xFFFF
);
}
// synchronized
}
/*************************************************************************/
}
}
/**
/**
* This method pushes all of the chars in the passed char array into
* the pushback buffer. These chars are pushed in reverse order so that
* the next char read from the stream after this operation will be
...
...
@@ -392,15 +336,12 @@ unread(int b) throws IOException
*
* @exception IOException If the pushback buffer is full
*/
public
synchronized
void
unread
(
char
[]
buf
)
throws
IOException
{
public
synchronized
void
unread
(
char
[]
buf
)
throws
IOException
{
unread
(
buf
,
0
,
buf
.
length
);
}
/*************************************************************************/
}
/**
/**
* This method pushed back chars from the passed in array into the pushback
* buffer. The chars from <code>buf[offset]</code> to <code>buf[offset + len]</code>
* are pushed in reverse order so that the next char read from the stream
...
...
@@ -416,9 +357,9 @@ unread(char[] buf) throws IOException
*
* @exception IOException If the pushback buffer is full
*/
public
synchronized
void
unread
(
char
[]
b
,
int
offset
,
int
len
)
throws
IOException
{
public
synchronized
void
unread
(
char
[]
b
,
int
offset
,
int
len
)
throws
IOException
{
synchronized
(
lock
)
{
if
(
buf
==
null
)
...
...
@@ -435,6 +376,5 @@ unread(char[] b, int offset, int len) throws IOException
// and in that case we don't want to modify pos.
pos
-=
len
;
}
}
}
}
// class PushbackReader
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment