Package java.io

Examples of java.io.DataInputStream.mark()


     */
    public PFBData parsePFB(InputStream in) throws IOException {
        PFBData pfb = new PFBData();
        BufferedInputStream bin = new BufferedInputStream(in);
        DataInputStream din = new DataInputStream(bin);
        din.mark(32);
        int firstByte = din.readUnsignedByte();
        din.reset();
        if (firstByte == 128) {
            pfb.setPFBFormat(PFBData.PFB_PC);
            parsePCFormat(pfb, din);
View Full Code Here


        out.close();
        DataInputStream in = new DataInputStream(tmp.getInputStream());
        byte[] data1 = new byte[sourceData1.length];
        byte[] data2 = new byte[sourceData2.length];
        in.readFully(data1);
        in.mark(sourceData2.length);
        in.readFully(data2);
        in.reset();
        in.readFully(data2);
        assertTrue(Arrays.equals(sourceData1, data1));
        assertTrue(Arrays.equals(sourceData2, data2));
View Full Code Here

  @Override
  public MessageDeserializer locateDeserializer(InputStream in) {
    MessageDeserializer deserializer = null;
    try {
      DataInputStream di = new DataInputStream(new BufferedInputStream(in));
      di.mark(3);
      int version = di.readUnsignedShort();
      di.reset();
      Class<DeserializeWorker> workerClass = deserializeWorkers.get(version);
      DeserializeWorker worker = workerClass.newInstance();
      worker.setInputStream(di);
View Full Code Here

    long startTime = FSNamesystem.now();

    DataInputStream in = new DataInputStream(new BufferedInputStream(edits));
    try {
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here

   
                boolean proceedNormally = true;
                if (discardOneSomewhereInDirectory)
                {
                    byte lenCheck[] = new byte[10];
                    inputrec.mark(20);
                    inputrec.readFully(lenCheck);               
                    if (byteCompare(lenCheck, 4, 5, totalOffset)) // proceed normally
                    {
                        proceedNormally = true;
                    }
View Full Code Here

                int fieldLength = getFieldLength(inputrec);
                if (fieldLength+1 != lengths[i] && permissive)
                {
                    if (numBadLengths < 3 && (totalLength + fieldLength < recordLength + 26))
                    {
                        inputrec.mark(9999);
                        byteArray = new byte[lengths[i]];
                        inputrec.readFully(byteArray);
                        inputrec.reset();
                        if (fieldLength+1 < lengths[i] && byteArray[lengths[i]-1] == Constants.FT)
                        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.