/[classpath]/classpath/java/io/RandomAccessFile.java
ViewVC logotype

Diff of /classpath/java/io/RandomAccessFile.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by mark, Sat Jul 2 20:32:38 2005 UTC revision 1.48 by gbenson, Wed Dec 7 15:27:05 2005 UTC
# Line 124  public class RandomAccessFile implements Line 124  public class RandomAccessFile implements
124    
125      ch = FileChannelImpl.create(file, fdmode);      ch = FileChannelImpl.create(file, fdmode);
126      fd = new FileDescriptor(ch);      fd = new FileDescriptor(ch);
127      out = new DataOutputStream (new FileOutputStream (fd));      if ((fdmode & FileChannelImpl.WRITE) != 0)
128          out = new DataOutputStream (new FileOutputStream (fd));
129        else
130          out = null;
131      in = new DataInputStream (new FileInputStream (fd));      in = new DataInputStream (new FileInputStream (fd));
132    }    }
133    
# Line 766  public class RandomAccessFile implements Line 769  public class RandomAccessFile implements
769     */     */
770    public void write (int oneByte) throws IOException    public void write (int oneByte) throws IOException
771    {    {
772        if (out == null)
773          throw new IOException("Bad file descriptor");
774    
775      out.write(oneByte);      out.write(oneByte);
776    }    }
777    
# Line 777  public class RandomAccessFile implements Line 783  public class RandomAccessFile implements
783     */     */
784    public void write (byte[] buffer) throws IOException    public void write (byte[] buffer) throws IOException
785    {    {
786        if (out == null)
787          throw new IOException("Bad file descriptor");
788    
789      out.write(buffer);      out.write(buffer);
790    }    }
791    
# Line 792  public class RandomAccessFile implements Line 801  public class RandomAccessFile implements
801     */     */
802    public void write (byte[] buffer, int offset, int len) throws IOException    public void write (byte[] buffer, int offset, int len) throws IOException
803    {    {
804        if (out == null)
805          throw new IOException("Bad file descriptor");
806    
807      out.write (buffer, offset, len);      out.write (buffer, offset, len);
808    }    }
809    
# Line 806  public class RandomAccessFile implements Line 818  public class RandomAccessFile implements
818     */     */
819    public final void writeBoolean (boolean val) throws IOException    public final void writeBoolean (boolean val) throws IOException
820    {    {
821        if (out == null)
822          throw new IOException("Bad file descriptor");
823    
824      out.writeBoolean(val);      out.writeBoolean(val);
825    }    }
826    
# Line 820  public class RandomAccessFile implements Line 835  public class RandomAccessFile implements
835     */     */
836    public final void writeByte (int val) throws IOException    public final void writeByte (int val) throws IOException
837    {    {
838        if (out == null)
839          throw new IOException("Bad file descriptor");
840    
841      out.writeByte(val);      out.writeByte(val);
842    }    }
843    
# Line 834  public class RandomAccessFile implements Line 852  public class RandomAccessFile implements
852     */     */
853    public final void writeShort (int val) throws IOException    public final void writeShort (int val) throws IOException
854    {    {
855        if (out == null)
856          throw new IOException("Bad file descriptor");
857    
858      out.writeShort(val);      out.writeShort(val);
859    }    }
860    
# Line 848  public class RandomAccessFile implements Line 869  public class RandomAccessFile implements
869     */     */
870    public final void writeChar (int val) throws IOException    public final void writeChar (int val) throws IOException
871    {    {
872        if (out == null)
873          throw new IOException("Bad file descriptor");
874    
875      out.writeChar(val);      out.writeChar(val);
876    }    }
877    
# Line 861  public class RandomAccessFile implements Line 885  public class RandomAccessFile implements
885     */     */
886    public final void writeInt (int val) throws IOException    public final void writeInt (int val) throws IOException
887    {    {
888        if (out == null)
889          throw new IOException("Bad file descriptor");
890    
891      out.writeInt(val);      out.writeInt(val);
892    }    }
893    
# Line 874  public class RandomAccessFile implements Line 901  public class RandomAccessFile implements
901     */     */
902    public final void writeLong (long val) throws IOException    public final void writeLong (long val) throws IOException
903    {    {
904        if (out == null)
905          throw new IOException("Bad file descriptor");
906    
907      out.writeLong(val);      out.writeLong(val);
908    }    }
909    
# Line 893  public class RandomAccessFile implements Line 923  public class RandomAccessFile implements
923     */     */
924    public final void writeFloat (float val) throws IOException    public final void writeFloat (float val) throws IOException
925    {    {
926        if (out == null)
927          throw new IOException("Bad file descriptor");
928    
929      out.writeFloat(val);      out.writeFloat(val);
930    }    }
931    
# Line 913  public class RandomAccessFile implements Line 946  public class RandomAccessFile implements
946     */     */
947    public final void writeDouble (double val) throws IOException    public final void writeDouble (double val) throws IOException
948    {    {
949        if (out == null)
950          throw new IOException("Bad file descriptor");
951    
952      out.writeDouble(val);      out.writeDouble(val);
953    }    }
954    
# Line 927  public class RandomAccessFile implements Line 963  public class RandomAccessFile implements
963     */     */
964    public final void writeBytes (String val) throws IOException    public final void writeBytes (String val) throws IOException
965    {    {
966        if (out == null)
967          throw new IOException("Bad file descriptor");
968    
969      out.writeBytes(val);      out.writeBytes(val);
970    }    }
971        
# Line 941  public class RandomAccessFile implements Line 980  public class RandomAccessFile implements
980     */     */
981    public final void writeChars (String val) throws IOException    public final void writeChars (String val) throws IOException
982    {    {
983        if (out == null)
984          throw new IOException("Bad file descriptor");
985    
986      out.writeChars(val);      out.writeChars(val);
987    }    }
988        
# Line 975  public class RandomAccessFile implements Line 1017  public class RandomAccessFile implements
1017     */     */
1018    public final void writeUTF (String val) throws IOException    public final void writeUTF (String val) throws IOException
1019    {    {
1020        if (out == null)
1021          throw new IOException("Bad file descriptor");
1022    
1023      out.writeUTF(val);      out.writeUTF(val);
1024    }    }
1025        

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26