Package java.io

Examples of java.io.FileDescriptor


        // RandomAccessFile write = new RandomAccessFile(file, "rwd");
        int fileSize = 10 * 1024 * 1024;
        IOUtils.setLength(write, fileSize);
        write.seek(0);
        int i = 0;
        FileDescriptor fd = write.getFD();
        while (true) {
            if (write.getFilePointer() >= fileSize) {
                break;
            }
            write.writeBytes(i + "\r\n");
            fd.sync();
            out.writeInt(i);
            out.flush();
            i++;
        }
        write.close();
View Full Code Here


        if (flush) {
            System.out.println("  with FileDescriptor.sync()");
        }
        RandomAccessFile file = new RandomAccessFile("test.txt", mode);
        file.setLength(0);
        FileDescriptor fd = file.getFD();
        long start = System.currentTimeMillis();
        byte[] data = { 0 };
        file.write(data);
        int i = 0;
        if (flush) {
            for (;; i++) {
                file.seek(0);
                file.write(data);
                fd.sync();
                if ((i & 15) == 0) {
                    long time = System.currentTimeMillis() - start;
                    if (time > 5000) {
                        break;
                    }
View Full Code Here

  }

  boolean gotReset = false;

  // acquire file descriptor and do the read
  FileDescriptor fd = impl.acquireFD();
   try
      n = socketRead0(fd, b, off, length, impl.getTimeout());
      if (n > 0) {
    return n;
      }
View Full Code Here

                s.impl.reset();
            }
      si = s.impl;     
      s.impl = null;
      si.address = new InetAddress();
      si.fd = new FileDescriptor();
      getImpl().accept(si);
      
      SecurityManager security = System.getSecurityManager();
      if (security != null) {
    security.checkAccept(si.getInetAddress().getHostAddress(),
View Full Code Here

    return;
      }
      throw new ArrayIndexOutOfBoundsException();
  }

  FileDescriptor fd = impl.acquireFD();
  try {
      socketWrite0(fd, b, off, len);
  } catch (SocketException se) {
      if (se instanceof sun.net.ConnectionResetException) {
    impl.setConnectionResetPending();
View Full Code Here

    /**
     * Creates a datagram socket
     */
    protected synchronized void create() throws SocketException {
  fd = new FileDescriptor();
  fd1 = new FileDescriptor();
  datagramSocketCreate();
    }
View Full Code Here

    /**
     * Creates a socket with a boolean that specifies whether this
     * is a stream socket (true) or an unconnected UDP socket (false).
     */
    protected synchronized void create(boolean stream) throws IOException {
  fd = new FileDescriptor();
  fd1 = new FileDescriptor();
  socketCreate(stream);
  if (socket != null)
      socket.setCreated();
  if (serverSocket != null)
      serverSocket.setCreated();
View Full Code Here

     * throws an IOException indicating what went wrong.
     */

    private synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
        try {
      FileDescriptor fd = acquireFD();
      try {
          socketConnect(address, port, timeout);
          /* socket may have been closed during poll/select */
          synchronized (fdLock) {
              if (closePending) {
View Full Code Here

    /**
     * Accepts connections.
     * @param s the connection
     */
    protected synchronized void accept(SocketImpl s) throws IOException {
  FileDescriptor fd = acquireFD();
  try {
      socketAccept(s);
  } finally {
      releaseFD();
  }
View Full Code Here

      this.someElement = null;

      this.someTimestamp = new Timestamp(System.currentTimeMillis());
     
      this.someArrayList = new ArrayList();
      this.someArrayList.add(new FileDescriptor());
     
      this.someFileDescriptor = new FileDescriptor();
     
      this.someNullObject = null;
   }
View Full Code Here

TOP

Related Classes of java.io.FileDescriptor

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.